Not sure if this is the right thinking but anyway, this is what I'm trying to do:
I have a Class which includes some variables and some methods. The class has itself some code thats executed where instansiating an object 'a('Call a method')'. I can call method a() but when method a() calls method b() it all fails.
Whats the reason for this and how should it be solved?
It's when the call b('aa') executes I get the error: 'NameError: global name 'b' is not defined'
Why can't method a() reach method b()?
I have a Class which includes some variables and some methods. The class has itself some code thats executed where instansiating an object 'a('Call a method')'. I can call method a() but when method a() calls method b() it all fails.
Whats the reason for this and how should it be solved?
It's when the call b('aa') executes I get the error: 'NameError: global name 'b' is not defined'
Why can't method a() reach method b()?
1 2 3 4 5 6 7 8 9 10 11 12 13 |
class TestClass: def __init__( self ): pass def b(name): print '---b---' , name def a(name): print '---a---' , name b( 'aa' ) a( 'Call a-method' ) |