I have the following directory structure:
package
├── __init__.py
└── core.py
where the contents of core.py
are:
def my_super_cool_func():
crufty_helper_func()
pass
def crufty_helper_func():
pass
and the contents of __init__.py
are:
from .core import my_super_cool_func
Now, if I go into the Python REPL, I can import package
. Moreover, I can do package.my_super_cool_func()
and I can't do package.crufty_helper_func()
(as expected). But what I can also do is package.core.crufty_helper_func()
, which to me, is undesirable.
Is there any way of excluding modules in a Python package? Ideally, in the setup above, I'd prefer for the core
module not to be visible in the package
package.