I have encountered a problem with variables which I have defined in a module and then manipulating them from other modules.
I have something like this in moduleA.py:
gVar = None
def getVar():
return gVar
def setVar(val):
gVar = val
Then, in moduleB.py I have this:
import moduleA #I also want to get rid of this import...
from moduleA import* #...and use only this import
print getVar() #prints "None"
setVar(10)
print getVar() #prints "None" <-- wrong!
moduleA.gVar = 10
print getVar() #prints "10"
How can I make it so that setVar() actually modifies the variable defined in moduleA.py?
Thanks for help,
Jusa