https://prefect.io logo
Title
j

Javier Helguera

03/24/2023, 3:37 PM
Hi everyone, it is my first time using Prefect and I'm not sure why the following code does not work. Basically I'm trying to set the @flow decorator to a method of a class:
from prefect import flow

class myClass:

    @flow(log_prints=True)
    def start(self):
        print("Start class")

if __name__ == "__main__":

    myclass = myClass()
    myclass.start()
This is the error that I get:
Error binding parameters for function 'start': missing a required argument: 'self'.
Thanks for your help!
r

redsquare

03/24/2023, 3:50 PM
flows/tasks are meant to be stateless really so you wont be able to do this
j

Javier Helguera

03/24/2023, 3:55 PM
I understand, thanks 🙂