hello all! what’s the best way to pass a Prefect k...
# best-practices
m
hello all! what’s the best way to pass a Prefect keyword to a new Task class? I want to do something like
Copy code
@task(key=value)
within a structure like
Copy code
class MyNewTask(Task): 
    def run():
         pass
where would I pass those key/value pairs when initializing the new capital-T Task?
k
You can try
Copy code
mnt = MyNewTask(key=value)

with Flow(..) as flow:
    mnt()
If that doesn’t work, look at this task from the task library. Specifically, note how
**kwargs
is passed to
super.init()
. You might need this in your Task definition I think. Or it might just work.
m
fantastic, thank you! 🙌