So my project structure is:
Application/
modules/
classes.py
game_logic.py
validations.py
static/
templates/
tests/
test_classes.py
test_game.py
app.py
so the following imports work:
# modules/classes.py:
from modules.validations import validate_word
# modules/game_logic.py:
from modules.validations import validate_word
from modules.classes import Round
# app.py:
from modules.classes import Game
from modules.game_logic import determine_results
However I now need to import to the test_ files the below and I am having trouble:
# tests/test_classes.py:
from modules.classes import Round, Class
# tests/test_game.py:
from modules.game_logic import determine_results
trying the above I get the following error:
E ModuleNotFoundError: No module named 'modules'
If I add either '..' or '.' preceeding the 'modules' I get the following error:
E ImportError: attempted relative import with no known parent package
I have now read quite a bit on this and understand that since python 3.3 we have not had to use __init__
.py files. I also know that I should be able to get a relative import like that above to work as I have tried it outside of this project. This is a Flask project; would that have anything to do with the problems being experienced?