First of all, I have look through a lot of question-answer regarding this issue but I couldn't find a solution to my problem.
I am on Python 3.7.9 and my file structure looks as in the following
generator/
__init__.py
main.py
summarygenerator/
__init__.py
utils.py
summary_generator.py
The summary_generator.py looks like
from summarygenerator.utils import solver
def sum_gen():
pass
if __name__ == '__main__':
sum_gen()
With this approach, from the 'generator' directory I am able to run main.py with:
python main.py
and summary_generator.py with
python -m summarygenerator.summary_generator
However, when I would like to run summary_generator.py from the generator/summarygenerator directory then I face with:
ModuleNotFoundError: No module named summarygenerator
Relative imports as in the below doesn't solve the issue as well.
from .utils import solver