# prefect-community

Daniel Sääf

05/18/2022, 12:32 PM
Hi! I finally had some time to dive into the world of prefect (partly motivated by the great interview in Talk Python With Me) I am trying to get prefect2.0 to run for a simple workflow - and everything was working really well when i followed the tutorial but i ran into an error as soon as i stepped out from the tutorial 🤦 (i realize that this might be something simple - but i’ve tried everything i could come up with and have been reading the docs a couple of times.. So excuse me if this is something obvious - i’m just stuck.. ) The problem occurs when i’m trying to create a deployment for my flow that runs well locally. My current setup is that i have the and (According to the tutorial) But i added a file (in the same directory as and from which i import a function called hello_world in the (from test import hello_world) As i said, i can run the flow as expected:
>>> result = leonardo_dicaprio("leo")
However, when i try to create the deployment i get a:
ImportError: cannot import name 'hello_world' from 'test' (/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/test/
So basically, my question is: how do i import functions from local python-files in a flow? (Let me know if this isn’t the right place for this type of questions!)

Anna Geller

05/18/2022, 12:38 PM
Nice, great to see this talk inspired you to try Prefect! This is a great question for this channel! I think one solution worth exploring is adding your custom directory to the Python path so that Python and prefect can find it

Daniel Sääf

05/18/2022, 12:49 PM
Ah, thanks! That was easy.. There are probably more robusts way of doing it, but if anyone else runs in to this i just solved it by running:
PYTHONPATH='.' prefect deployment create
👍 2