Reputation: 329
I've got this dts:
Pipfile
module-common\
__init__.py
setup.py
common\
library-common.py
module-a\
__init__.py
setup.py
functional-module\
library-a.py
library-b.py
Pipfile is defined as
...
[packages]
module-common = {file = "module-common", editable = true}
module-a = {file = "module-a", editable = true}
setup.py are defined as
from setuptools import find_packages, setup
setup(
name="module-common",
version="2",
...
packages=find_packages(),
...
)
and
from setuptools import find_packages, setup
setup(
name="module-a",
version="2",
...
packages=find_packages(),
...
)
init.py files are empty
I installed all with
pipenv install -e module-common
pipenv install -e module-a
pipenv install
pip list
is correctly showing my packages into the dts
so, in library-a I want to use a function from library-common,
but this declaration of library-a fails
from common.library-common import SomeClass
print(f"function return: {SomeClass.function()}")
and results in:
NameError: name 'library-common' is not defined
but if I declare
import common
print(f"function return: {common.common-function.SomeClass.function()}")
I got the correct answer.
what am I missing here? how do I get first notation to work?
the purpose is trying not touch library-a code, leave the imports as they are to avoid refactoring the whole codebase
Upvotes: 1
Views: 19