Calling functions in main script from a module

James Bursa james at bursa.freeuk.com
Wed Sep 22 16:41:48 EDT 1999


In message <000701bf04bd$3dcf7780$342d153f at tim>
          "Tim Peters" <tim_one at email.msn.com> wrote:

> [James Bursa]
> > Is it possible to call a function in the main script (the one
> > passed on the Python command line) from a module function?
> >
> > I've attempted to use something like __main__.function(), but this
> > doesn't work. ...
> 
> What does "doesn't work" mean?  Works for me.  Perhaps you didn't import
> __main__ in the other module first; without code and a traceback, nobody
> can guess.

Yes, that was it - I didn't realise __main__ had to be imported. Thanks for
your help.

James

-- 
James Bursa                                          james at bursa.freeuk.com
Cambridge, UK                           http://home.freeuk.net/bursa/james/




More information about the Python-list mailing list