Tuesday, 30 March 2021

ModuleNotFoundError when I am trying to import package

my_controller.py is as follow:

from models import Person

david = Person('David')

And my project structure is

app
├── controller
│   └── my_controller.py
│   
└── models
    └── __init__.py
    └── person.py

I must do something wrong because I keep get

ModuleNotFoundError: No module named 'models'    

What is the correct way to import class Person to my_controller.py?

PS I am working on ubuntu



from ModuleNotFoundError when I am trying to import package

No comments:

Post a Comment