On Sat, Jun 7, 2014 at 11:40 AM, 1989lzhh <1989l...@gmail.com> wrote:
> Here is the code
> def f():
> print globals()
> from m1 import f
> f()# how to get current module's globals?
Evaluate globals() in the current module and pass the resulting dict
in as a parameter:
from m1 import f
There's a code smell here, though. If your function really needs to
interact with globals from other modules, then those should probably
not be globals in the first place. More likely they should be
attributes of objects that can be easily passed around.