How to import Python files in the other directories?

Christian Heimes lists at cheimes.de
Fri Mar 6 02:10:53 EST 2009


Muddy Coder schrieb:
> Hi Folks,
> 
> If I have a python file foo.py in the current directory, I can simply
> import it in the way below:
> 
> import foo
> 
> when a project keeps grow, more and more Python files are created, and
> they are also needed to put into different directories. Then, a
> problem comes: how to import the Python files residing in the other
> directories? Somebody helps me out? Thanks!

Use packages: http://docs.python.org/tutorial/modules.html#packages

Christian




More information about the Python-list mailing list