I'm sure this has to be a duplicate, but I can't find the answer.
I have the following setup:
example
├── __init__.py
├── submod
│   ├── __init__.py
│   ├── subscript1.py
│   └── subscript2.py
└── toplevel.py
There is a function in subscript1 that I want to call in toplevel when I run from the command line by:
python toplevel.py
I can do the following and it works:
from submod import subscript1
subscript1.my_func()
but what I want to do is:
import submod
submod.subscript1.my_func()
And this is giving an error of:
AttributeError: module 'submod' has no attribute 'subscript1'