https://kedro.org/ logo
#questions
Title
# questions
c

charles

06/05/2023, 11:15 PM
hey folks - I've got a python module named database sitting in the same repo as my kedro project. I can't seem to get it recognized. tried using hooks, altering the PYTHONPATH but nothing. just ModuleNotFoundError. any idea how I can overcome? • database/ • kdr_project/ ◦ src/ ▪︎ project/ • pipelines/ ◦ mypipeline/ ( file in here is where I am importing database
j

Juan Luis

06/06/2023, 6:05 AM
hi @charles ! The PYTHONPATH trick should work, but it’s not very sustainable. however, in your tree database/ would be a package, not a module (that would be database.py)
this is more of a Python question, nothing here is specific to Kedro
c

charles

06/06/2023, 1:27 PM
PYTHONPATH isn't working. I pip install the package now. Works locally. In our container I can import the package from the python interpreter but the kedro pipeline itself is giving ModuleNotFound. What could be going on here?
j

Juan Luis

06/06/2023, 1:43 PM
PYTHONPATH
trick works for me with the same structure you have
c

charles

06/06/2023, 1:49 PM
i'm stumped
Untitled
that's my Dockerfile. maybe you can spot what the problem is?
j

Juan Luis

06/07/2023, 6:53 AM
@charles if your import statement is
import db
, then
PYTHONPATH
should be
/home/kedro_docker
c

charles

06/08/2023, 11:02 AM
this saved my butt last night @Juan Luis i cannot thank you enough
🥳 1
j

Juan Luis

06/08/2023, 11:02 AM
happy to help! 😄