Hi there !
I have a project I build on a library I'm building in parallel. The structure is the following :
project/
main.py
MyLibrary/
__init__.py --> empty
Module1.py --> contain the class Class1
Module2.py --> contain the class Class2
Module3.py --> contain the class Class3
...
I need to import the class Class2 into Class1.py, if I do
from Module1 import Class1
it's ok. But when in project/main.py I do
from MyLibrary import Module1
I got ImportError: No module name Module1
I could solve the issue by replacing:
from Module1 import Class1
by
from .Module1 import Class1
But then I'm not able any more to run Module1.py direcly (Python complain that I'm trying to do a relative impact on a non package...). And I need that to run test.
How I could I have import that work in both case ?
Thank for your attention !
edit: the first described solution seems to work on my linux desktop but not on my windows Xp powerred laptop. It's weird...