Importing module from another subdirectory

Rich Shepard rshepard at
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

> bustrac/
>    README.rst
>    controller/
>    classes/

>    scripts/
>    gui/
 tries to import from the classes package:
from classes import model as m

Running in bustrac/ produces this error:

$ python3 gui/ 
Traceback (most recent call last):
   File "gui/", 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 module from modules in other
subdirectories of bustrac/.

A clue stick is needed.



More information about the Python-list mailing list