access interactive namespace from module (shared namespace?)

ulrich at dorda.net ulrich at dorda.net
Sun May 25 06:32:30 EDT 2008


Thanks for the reply,

Of course the suggested solution is working and good, but a bit
complicated. The module/function where i need to access the variable
value from the interactive shell is burried quite deep and I would
nedd to hand the locals() quite often from one module to another.
Furthermore it makes the call function slightly more complicated, as
the locals()-argunment has to be given every time.

I was hoping for something a bit different: If I wanted to access a
value b from another module "utest2.py", I would simply need to type
in utest.py: import utest2; print 2*utest2.b
Isn't there a name for the interactive namespace (like here the
utest2), which I can use to access the variable without handing the
whole dictionary?

Cheers,

Ulrich






More information about the Python-list mailing list