I am a beginner with Python. Before I start, here is my python folder strcuture.
-project
---main.py
---secondary-folder
----------new_main.py
---model
----------__init__.py
----------abc.py
Under project
folder I have a model
folder which has two python files __init__.py
and abc.py
which contents follow:
class ABC:
def print_abc(self):
print("abc")
Next in my main.py
and new_main.py
are the same contents:
from model.abc import ABC
if __name__ == "__main__":
ABC().print_abc()
Whenever I run python3 ./secondary-folder/new_main.py
under project
folder it results in the error:
Traceback (most recent call last):
File "./secondary-folder/new_main.py", line 1, in <module>
from model.abc import ABC
ModuleNotFoundError: No module named 'model'
But the terminal can print out abc
if I run main.py
under project
folder.
Is there anything I missed?