I want to import an object from a module in a package inside another module of a sibling package. But the parent directory has the same name as one of the packages.
Here is the structure I am struggling with:
foo{
__init__.py
foo{
__init__.py
models.py
}
bar{
__init__.py
models.py
}
}
Inside of foo
(not the parent) I want to import an object from bar.models
.
I tried this:
from foo.bar.models import MyObject
and
from ..bar.models import MyObject
None worked, how do you do ?