I have a python module with the following structure:
my_mod
|--- __init__.py
|--- mod1
| |---- __init__.py
|---- testA.py
|---- testB.py
|---- testC.py
Inside each testX.py is a single function that is named testX. These functions are large so to keep my files manageable I separated testA,B, and C out. To avoid having to access these functions in this manner:
import my_mod.mod1.testA.testA
My mod1/__init__.py
file is structured as follows:
from .testA import testA
from .testB import testB
from .testC import testC
So my functions are now accessible as
import my_mod.mod1.testA
This behaves as expected. However when I go to autodoc my module with Sphinx the documentation misses this feature in the __init__
and I end up with my functions being documented as
my_mod.mod1.testA.testA(blah, blah, blah)
Which is not the actual usage and will fail if called in an actual script.
Is there a way for Sphinx to understand this? Or if not a better way to structure my module to keep my file size small but avoid duplicate names on import?
Thanks for the help