Module access from inside itself

Oren Tirosh oren-py-l at hishome.net
Fri Aug 15 12:48:16 EDT 2003


On Fri, Aug 15, 2003 at 04:20:43PM +0000, Steven wrote:
> I'm writing a Python script which can be called from the command-line, and 
> I want to use my module doc string as the CL help text, but I don't know 
> how to access my module object from inside the module.

You don't need the module object for this. MY_MODULE.__doc__ is the 
same as accessing __doc__ directly.

If you really need the current module object use sys.modules[__name__]

    Oren





More information about the Python-list mailing list