[Tutor] python import problem

Alan Gauld alan.gauld at freenet.co.uk
Wed Aug 9 13:16:03 CEST 2006


> the folders modules and translate are in the same level, so if I 
> want to
> import factory.py into myfile.py, how can I do?

You need to make your folders into packages.
Its fairly simple, you basically create an init.py file
But its worth reading about packages in the docs
Come back here ifv you have any questions after that.

The other way would be to add each folder to
your PYTHONPATH

HTH,

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 



More information about the Tutor mailing list