Access to main namespace from imported module?

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Mon Apr 1 13:12:47 EST 2002


Just curious, like, but is it possible for an included module to
reference the namespace of the outer-most module, "__main__".

I can't see a way.

For example:

Module A contains:

-----
import moduleb

def wibble():
    """Handy docstring."""

-----
Module B contains:
-----
def wobble():
    print __main__.wibble.__doc__
-----

Obviously, this doesn't work but the way that __main__ is described in
the docs suggests that it might.

Thanks
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list