https://prefect.io logo
Title
s

Shaoyi Zhang

06/29/2022, 6:54 PM
Hi, question regarding flow registration - During follow registration, it requires packages used in the flow to be already installed on the machine. One walkaround is to import packages inside each tasks, however, is there a way to not duplicate code and import at top level? Thank you!
j

James Sopkin

06/29/2022, 7:03 PM
Is there a reason why you wouldn't install the packages and import them at the top? You shouldn't need to do imports within tasks
s

Shaoyi Zhang

06/29/2022, 7:19 PM
We have separate flow images for different tenants, but a single image used in CI/CD for registering the flows.
k

Kevin Kho

06/30/2022, 8:42 AM
I don’t think you can because
import pandas as pd
makes a variable named
pd
of type
Module
. But putting it inside a task makes it a local variable.