Module access from inside itself

Oren Tirosh oren-py-l at
Fri Aug 15 18:48:16 CEST 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__]


More information about the Python-list mailing list