how do I import from other directories?

Gillou nospam at bigfoot.com
Tue Dec 17 10:05:21 EST 2002


"Peter Rams" <peter.rams at sap.com> a écrit dans le message de news:
atnb1r$gdl$1 at news1.wdf.sap-ag.de...
> Hi,
>
> I want to import a module from another directory. Normally I would set a
> path to the directory in the enviroment, but I'm running my script on the
> server of my provider, so I think I can't change the enviroment here.
>
> Is somethink like: import "/home/username/mydic/module.py" possible in
> python?
>
> Thanks,
> Peter
>
>

Suppose your personal modules are in /home/me/pymodules

import sys
sys.path.append('/home/me/pymodules')
import mymodule
...






More information about the Python-list mailing list