How to - import code not in current directory

py codecraig at gmail.com
Thu Nov 17 08:41:01 EST 2005


Claudio Grondi wrote:
> so this should work in your case:
>
> import sys
> sys.path.append("C:\some\other\directory")
> import bar

...that will certainly work.  Only issue is that each time I start up
foo.py in the python shell I have to retype those three lines....kind
of why I was hoping for a environment variable or path setting that i
could stick in.

This will do for now...




More information about the Python-list mailing list