<div dir="ltr"><div><div><div>Thats a good pointer to what is going on. Thank you Bas.<br><br></div>I am familiar with error such as<br><br>x=1<br>def foo():<br>    x = 2<br>    def erm():<br>        print(x)<br>        x=3<br>

    erm()<br>foo()  <br>UnboundLocalError: local variable 'x' referenced before assignment.<br><br></div>It
 seems a bit different for classes (below), as it jumps out to get the 
value from the global name space, where it didn't for functions (above).<br>
<br>x=1<br>def foo():<br>    x = 2<br>    class erm():<br>        print(x)<br></div><div>        x = 3<br></div><div>foo()      # This evaluates == 1  <br><br></div>But you certainly have explained why  "NameError: name 'third' is not defined" occurs.</div>