I have a python project in Pycharm, wherein there is a nested Git submodule. Here is the folder structure:
my-git-repo
git-submodule-repo
package1
foo.py
bar.py
package2
baz.py
.gitmodules
The imports in git-submodule-repo
are structured as follows:
foo.py:
from package1.bar import some_func
However, Pycharm doesn't recognize this and wants me to instead have the following:
foo.py:
from git-submodule-repo.package1.bar import some_func
This is problematic because I don't want to have to change all the imports in git-submodule-repo
(doesn't seem like good practice and isn't scaleable) and git-submodule-repo
has dashes in it which isn't valid Python syntax for an import (I can't rename the repo).
I also need a way to import from git-submodule-repo
in my code. Something like this:
baz.py:
from git-submodule-repo.package1.bar import some_func
But of course without the dashes making it invalid syntax. Here is the content of .gitmodules
in case its useful:
[submodule "git-submodule-repo"]
path = git-submodule-repo
url = https://github.com/SomeAccount/git-submodule-repo.git
Any help would be appreciated!