Variable passing between modules.
Josef Meile
jmeile at hotmail.com
Thu Sep 9 13:09:18 EDT 2004
Golawala, Moiz M (GE Infrastructure) wrote:
> The example that I provided was very simplistic. I have a tones of methods in module 2 and the method need to get executed and need the someVar value.
>
> I was thinking like setting up some a value in some global VM list which can be accessed by all modules.
You could do this:
module1:
varDict={}
varDict['foo1']='hello'
varDict['foo2']='world'
module2:
from module1 import varDict
print varDict.get('foo1')
print varDict.get('foo2')
Regards,
Josef
More information about the Python-list
mailing list