Importing module from another subdirectory

Rich Shepard rshepard at appl-ecosys.com
Thu Apr 25 08:37:05 EDT 2019


On Thu, 25 Apr 2019, dieter wrote:

> The means that "test_act_de.py" has not extended "sys.path"
> appropriately.

Dieter,

That's what I thought.

> When Python starts a script ("gui/test_act_de.py" in your case), it
> automatically extends "sys.path" with the folder containing the script
> ("gui" in your case).

This is what I expected based on what I read, and ...

> If Python needs to find modules elsewhere, you must extend "sys.path" to
> tell it where it should look.

this is what I missed in my reading. I'll explicitly extend sys.path when
it's not done automatically.

I've taken your suggestion of developing each project in its own virtual
environment and I think that explicitly appending imported packages will
resolve all these issues.

Many thanks,

Rich



More information about the Python-list mailing list