Loading modules from several directories
lists at gregfortune.com
Wed Sep 18 15:06:56 EDT 2002
If it is indeed a package, you don't need to append both paths. Just use:
Furthermore, any module in project_a can access modules in foo by using
import foo.foostuff and the package will know how to resolve the location.
Miki Tebeka wrote:
> Hello Eugene,
>> Trying to reuse the code I found a problem (with Python or me) where
>> if I have for example, a foo package in two separate directories
>> (where foo/ contains common files and foo/project_a/ contains
>> project-specific files) I can't load from both.
>> If I put the common path first in the sys.path it tries to load the
>> project-specific stuff from there too. If I try putting the
>> project-specific one first it can't find the common stuff.
>> Anyone know of a good solution for this problem?
> import foostuff
> import projectstuff
More information about the Python-list