Importing some functions from a py file

Michael Soulier msoulier at gmail.com
Tue Apr 19 22:43:15 EDT 2005


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()

Mike

-- 
Michael P. Soulier <msoulier at gmail.com>
http://www.digitaltorque.ca
http://opag.ca      python -c 'import this'
Jabber: msoulier at digitaltorque.ca



More information about the Python-list mailing list