I put the method in mymodule.py file:
def do_something():
global a
a=1
If i try
>>> execfile('mymodule.py')
>>> do_something()
>>> print a
I get "1" as I expect. But if I import a module,
>>> from mymodule import *
and then run do_something (), then the python session knows nothing about the variable "a".
Can someone explain the difference to me? Thanks.
source
share