Hello, I am new to Prefect. I want to structure my...
# ask-community
p
Hello, I am new to Prefect. I want to structure my code so it can be run as Prefect workflow and optionally normal python program (Not as Prefect workflow). All functions has Task decorator and it can't be called like normal Python function. Please advise.
k
Hey @Patrick Tan, you can call a task with `task.run()`so
Copy code
@task
def abc():
    return 1

abc.run()
or you can convert a function to a task during runtime
Copy code
def abc():
    return 1

abc_task = task(abc)
upvote 2
👍 1
a
Do you know that you can run Prefect flows locally just like normal Python scripts?
p
Thanks @Kevin Kho, works like a charm!
👍 1