B
BBands
An example:
class classA:
def __init__(self):
self.b = 1
def doStuff():
some calcs
a..b = 0
a = classA():
print a.b
doStuff()
print a.b
That works as hoped, printing 1, 0.
But, if I move doStuff to another module and:
import doStuff
class classA:
def __init__(self):
self.b = 1
a = classA()
print a.b
doStuff.doStuff()
print a.b
I get a 1 printed and an error: NameError: global name 'a' is not
defined
I think this is a name space issue, but I can't grok it.
Thanks in advance,
jab
class classA:
def __init__(self):
self.b = 1
def doStuff():
some calcs
a..b = 0
a = classA():
print a.b
doStuff()
print a.b
That works as hoped, printing 1, 0.
But, if I move doStuff to another module and:
import doStuff
class classA:
def __init__(self):
self.b = 1
a = classA()
print a.b
doStuff.doStuff()
print a.b
I get a 1 printed and an error: NameError: global name 'a' is not
defined
I think this is a name space issue, but I can't grok it.
Thanks in advance,
jab