I have packaged modules A.py
and B.py
into a PyPI package P
. Inside A.py
, there is a function a()
which imports a function b()
from B.py
. I.e., A.py
looks like
from B import b
def a():
<some `a` code>
b()
and B.p
looks like
def b():
<some `b` code>
Like I said, both modules were packaged into P
. I then go to an environment where neither A.py
nor B.py
are present, run pip install P
, and do the following in Python
from P.A import a
a()
I then get the error No module named B
.
How can I resolve this?
In A.py use import as
from .B import b