I currently have the following package structure
mypkg/
|-__init__.py
|-foo/
|--_init__.py
|--foo_one.py
|--foo_two.py
|--foo_three.py
|-bar/
|-__init__.py
|- ...
Inside foo_one.py
, foo_two.py
and foo_three.py
I defined three classes, FooOne
, FooTwo
and FooThree
.
I would like to be able to import them as
from mypkg.foo import FooOne, FooTwo
At the moment the solution I'm using is the following:
# mypkg/foo/__init__.py
from .foo_one import FooOne
from .foo_two import FooTwo
from .foo_three import FooThree
But I think that what this actually does is importing all the classes, regardless of the specific import statement I use.
I would like to avoid that since the three classes require different additional import statements.
Also I would like to keep the three classes in three different files.
What do you suggest?