Importing module from another subdirectory
rshepard at appl-ecosys.com
Wed Apr 17 16:50:25 EDT 2019
What is the proper syntax to import the model class in the model/
subdirectory into a tkinter view module, e.g., activities.py? The syntax,
'import model as m' fails because it is not in the same subdirectory as the
The program directory tree is:
Running pdb in python3-3.7.3 produces the same error:
Python 3.7.3 (default, Mar 26 2019, 06:40:28)
[GCC 5.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdb
>>> import activities_data_entry
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rshepard/development/business_tracker/views/activities_data_entry.py", line 1, in <module>
import model.activities as act
ModuleNotFoundError: No module named 'model'
My previous use of python has had all files in the same directory so I've
not before had to learn how to address this issue. Pointers appreciated.
More information about the Python-list