My folder structure is something like this:
test.py
Module\
-__init__.py
-Submod1\
--__init__.py
--file1.py
-Submod2\
--__init.py
--file2.py
On my file2.py, I wrote something like this:
from ..Submod1 import file1
def test():
print('success')
if __name__ == '__main__':
test()
If I try running the test.py file (on same folder as Module):
from Module.Submod2 import file2
file2.test()
this works just fine. But, if I try running the file2.py, I got the error:
ImportError: attempted relative import with no known parent package
What am I doing wrong here?