import

Gary Herron gherron at islandtraining.com
Fri Jul 6 03:07:30 EDT 2007


jolly wrote:
> Hey guys,
>
> I'm rather new to python and i'm have trouble(as usual)
>
> I want to know if it is possible to change where 'import' looks....
> this will save me clogging up my python directory
>
> Thanks
>   
Easily done.  The value of sys.path is a list of directories that import 
looks through to satisfy an import.  Just import sys and append a new 
directory to sys.path. 

import sys
sys.path.append('/your/directory/of/importable/modules')
// Then import code from your directory.





More information about the Python-list mailing list