https://prefect.io logo
Title
r

Rafael Sá

03/15/2022, 8:16 PM
Hi folks, is it possible to call a task inside another task? Something like this: def function_a(): c = a + b return c task def do_something(): y = function(a) return y
k

Kevin Kho

03/15/2022, 8:16 PM
You can use the Python under the hood by doing
task.run()
but it’s not a task anymore with observability. It is just a Python function
r

Rafael Sá

03/15/2022, 8:21 PM
so i cloud call function_a.run()..?
k

Kevin Kho

03/15/2022, 8:22 PM
Is function_a a task or function?
r

Rafael Sá

03/15/2022, 8:22 PM
a task
k

Kevin Kho

03/15/2022, 8:23 PM
Then yes
function_a.run()
But in the code above, you may as well just keep function_a as a function and just call the function inside the task
r

Rafael Sá

03/16/2022, 1:37 PM
Hi Kevin, as a feedback to all your help yesterday, I was trying to running a for looping inside the With flow block, but I did'nt realize I could use just the map function and prefect do all the heavy lift for me... Thanks for directing my attention.
👍 1