For months I have tried to import my own classes from a subdirectory in Python, but I am yet to succeed in this task. It is a no-brainer in any other language, even C++.
Here is my app.py:
# my classes
from .classes.questions import Questions
from .classes.question import Question
from .classes.user import User
# ...
Here is my Questions class:
from question import Question
class Questions:
def __init__(self):
self.questions = []
Here is my directory structure:
.
├── app.py
├── classes
│ ├── question.py
│ ├── questions.py
│ └── user.py
Note 1: I have tried CamelCase naming for the modules.
Note 2: I have tried having init.py in any and all folders, but I'm on Python 3.8
The error message that is menacing me:
While importing 'app', an ImportError was raised.
in any and every environment.
I can import modules/classes with no issue as long as they are in the same folder as app.py.
How may I succeed in this daunting task?