Importing module from another subdirectory
Rich Shepard
rshepard at appl-ecosys.com
Wed Apr 24 17:07:45 EDT 2019
On Wed, 24 Apr 2019, Rich Shepard wrote:
> The current project's directory structure is:
I changed package names so there are no duplicate names for packages and
modules.
> bustrac/
> README.rst
> bustrac.py*
> controller/
> classes/
model.py
> scripts/
> gui/
test_act_de.py
test_act_de.py tries to import model.py from the classes package:
from classes import model as m
Running in bustrac/ produces this error:
$ python3 gui/test_act_de.py
Traceback (most recent call last):
File "gui/test_act_de.py", line 1, in <module>
from classes import model as m
ModuleNotFoundError: No module named 'classes'
Despite re-reading the web page, definitive-guide-python-imports.html, I'm
still not seeing how to import the model.py module from modules in other
subdirectories of bustrac/.
A clue stick is needed.
Regards,
Rich
More information about the Python-list
mailing list