Importing some functions from a py file

Anthony Liu antonyliu2002 at yahoo.com
Tue Apr 19 22:52:17 EDT 2005


--- Michael Soulier <msoulier at gmail.com> wrote:
> On 4/19/05, Anthony Liu <antonyliu2002 at yahoo.com>
> wrote:
> > But every time, I run code2.py, the main() of
> code1.py
> > is run.
> 
> You probably did not protect your main function in
> both modules. 
> 
> ie. 
> 
> if __name__ == '__main__': main()
> 

You are certainly right, because I don't know how to
protect the main functions.  Where do I put

if __name__ == '__main__': main()

?




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search. 
http://info.mail.yahoo.com/mail_250



More information about the Python-list mailing list