Project layout / Import files from different subdirectories
Steve Holden
steve at holdenweb.com
Tue Nov 11 09:10:04 EST 2008
Almar Klein wrote:
> If your main file is in the root of the project, you can just
> use absolute imports. So you can use gui.anotherwindow
> or project.important from all files.
>
> I'm not sure this is good practice though...
>
> I was first under the impression that you can always import
> modules that are in your current working dir. But this seems
> to not always work...
>
It works when the program you are executing is in the current working
directory, because Python always puts the directory containing the
program you are executing (not the current working directory) on the path.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list