My python app has a folder structure like this:
my_repo/
src/
main.py
util/ <-- util is a git submodule
src/
torgle.py
test/
test_torgle.py
test/
test_main.py
Inside main.py
, I can import stuff in my util
submodule like this:
from util.src.torgle import Torgler
But src/
is just a way to keep things organized in my git submodule repo, and shouldn't really be a logical part of the package name inside the main repo. Is there some way I can skip the src
part of the module import? I'd rather do this:
from util.torgle import Torgler
I.e. can I essentially alias util/src
folder to the Python util
package?
(Note that in my real case I have more deeply nested packages (util.x.y.z.torgle
), so from util import torgle; torgle.Torgler(...)
won't scale well. I'm specifically interested in from util.torgle import Torgler
.)