I've tried adding it directly to path through control panel ('c:\projects\parser'), and also appending it before I try my import. It works with the childs folder, not the parents.
.
└── parser
└── tests
├── __init__.py
└── utils
├── __init__.py
└── rebuild_parsers.py
This is what I've tried.
C:\>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('c:\\projects\\parser')
>>> from tests.utils.rebuild_parsers import build_lexer_parser
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tests.utils'
>>> sys.path.append('c:\\projects\\parser\\tests')
>>> from utils.rebuild_parsers import build_lexer_parser
I don't really understand why is it not working. Both folders (tests and utils) have an __init__.py file
Of course if I run it from the parser folder, it works, I just want to understand why it doesn't get it as a module.
C:\Projects\parser>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tests.utils.rebuild_parsers import build_lexer_parser
>>>