I am writing a sequence to sequence model and I have the following directory structure
MyProject/ models/ - __init__.py - Encoder.py train/ - __init__.py - Train.py While in Train.py, I cannot import the classes BiDirectionalEncoder from Encoder.py despite trying to use the following syntax
from models.Encoder import BiDirectionalEncoder For the line above I get the error " ModuleNotFoundError: No module named 'models'"
from ..models.Encoder import BiDirectionalEncoder For the last line I get the error "ImportError: attempted relative import with no known parent package"
Is there are neat way to fix this? I dont want to use any sys.path.append() to force paths to be added I am using Python 3.7.6 in Spyder 4.0.1 Thanks!
from models.Encoder import BiDirectionalEncoderis it not working?Train.pythen the system can't find the main My project path.