'Import command fails when repository is used as a submodule
Sorry, I know it's a overasked topic but I'm pretty new to these stuff and didn't understand. I have a repository with the following structure:
repo_name/
func_folder1/
func_file1.py -> func_1()
func_folder2/
func_file2.py -> func_2()
func_2() exploits returned values of func_1() so I use the
from func_folder1.func_file1 import func_1
command line inside func_file2.py to make everything work... and it works. Now, I have another repository "repo_name2" where I need many services from "repo_name", so I added the latter as a submodule. Unfortunately an error arises:
ModuleNotFoundError: No module named 'func_folder1'
If I change the import to
from ..func_folder1.func_file1 import func_1
it works in the repo_name2 but not in the repo_name. Seems pretty annoying to change it every time. Any idea?
(Python 3.9.7, Windows 10)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|