Hey! Is it possible to run a flow that imports a t...
# ask-community
b
Hey! Is it possible to run a flow that imports a task from a parent directory? To my understanding, prefect runs the flow as a python script, so the import system is messed up. I can get around this by adding folders to the path by:
Copy code
sys.path.append(str(pathlib.Path(__file__).parent.parent))
Thanks!
c
Hey Bil! Yes this should be possible without manipulating the python path manually. Depending on what type of remote code storage you use, Prefect should execute your flow from the root of that directory and your imports should be preserved. Do you have a reproducible example where that is not working?
b
Thanks for the reply, I'm using git as my code storage. I've worked around this by putting all my common tasks in a Python package which I install in the docker running the flow.