Get __doc__ from main module in imported module.

David davidism at
Thu Feb 11 01:48:39 CET 2010

I have a module with some functions I use often.  One of
these functions displays a usage message (__doc__).

def usage(messages=[], exit=-1):
    """Print the doc string as wells as any useful messages."""
    for message in messages:
    if exit >= 0:

I import this module into another module, with the doc string I want
to display.  However, calling usage prints toolkit's doc string
(None), not the current module's doc string.

How can I access the top level module's doc string from toolkit?

More information about the Python-list mailing list