How do I access a main frunction from an import module?
robert
no-spam at no-spam-no-spam.invalid
Fri Nov 24 09:39:49 EST 2006
Jim wrote:
> Hi,
>
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###################
> def a():
> m()
> return None
> ####################
>
> file main.py:
> #####################
> from abc import *
> def m():
> print 'something'
> return None
>
> a()
> ######################
>
> python25.exe main.py
>
import __main__
...
__main__.m()
but better make a start.py and "import main" - then its symmetric
Robert
More information about the Python-list
mailing list