I have this directory structure obtained with setuptools:
root/
A/
__init__.py
1.py
2.py
B/
__init__.py
3.py
__init__.py
the package section is the following:
packages=['root', 'root.A', 'root.B', ],
to import the content of the inner .py files i use:
from root.A import 1
from root.B.3 import a_func
now, if i wanted to import a_func directly from the root module, i would add the following line to the init file in the root directory
# to allow root.a_func access
from .B.3 import a_func
but is there a way to import an entire module instead of a single specific item (while preserving the same directory structure) ?
from root import 1
from root.3 import a_func
in other words, is it possible to hide the access of an intermediate level module during import?
I have already tried to add the following lines to the init file in the root dir, but it does not work.
from .A import *
from .B import *
any suggestion?