How do I access a main frunction from an import module?

Fredrik Lundh fredrik at pythonware.com
Fri Nov 24 13:14:03 EST 2006


Jim wrote:

> Application abc is designed as a complete module.  The user is to
> script their own functions to work with application abc.

so use execfile() with a prepared namespace:

     namespace = { ...stuff to export to the module ... }
     execfile("directory/module.py", namespace)

</F>




More information about the Python-list mailing list