Hello, I have a question about objects that we nee...
# prefect-community
h
Hello, I have a question about objects that we need to pass from task to task. In our case, we have a flow-config object, which is an array of dictionary json that is fetched config-object from firstore at task_2 of our flow and need to be passed throughout every task in the flow. Could we define a global variable in python file to hold this config-object, or shall we define it as a function param in every task and pass it through?
j
If this object is the result of a task, you'll need to pass it into any downstream tasks that rely on it.
If it's some static thing, then defining it as a global variable should work just fine.
h
thank you!
got it. If it’s static, shall I define a global variable at global scope of python file (outside flow) or in the flow definition? I assume the former, just to check
j
Meaning inside a
with Flow(...)
block? Either should work, python scoping means they'd both be defined at the top level as globals. Up to you.
h
yep, inside
with Flow(...)
.
thank you.