'Relative import python (no known parent)

I have the following dir structure:

enter image description here

both the train and utils dir have init.py. I am trying to import utils.logger from within train/main.py:

from ..utils.logger import Logger

but it gives the "not known parent package error":

File "train/main.py", line 4, in from ..utils.logger import Logger ImportError: attempted relative import with no known parent package



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source