https://prefect.io logo
j

John Kang

08/05/2022, 7:25 PM
Question, I'm trying to debug one of my functions that I've decorated with the task decorator, but I have the below error. I try to call the task with
task.fn(function_to_call())
but that doesn't work as I get this error:
AttributeError: 'function' object has no attribute 'fn'
`RuntimeError: Tasks cannot be run outside of a flow. To call the underlying task function outside of a flow use
task.fn()
.`
1
Any tips on how to run tasks outside of flows to debug?
I can just remove the decorator, but seems like a way for me to forget to add back in
n

Nico Neumann

08/05/2022, 7:30 PM
It should be
function_to_call.fn()
🙌 3
🙏 1
task is just a placeholder for your task function name
j

John Kang

08/05/2022, 7:32 PM
@Nico Neumann OH! Thanks!