Having trouble accessing the flow name from within...
# ask-community
a
Having trouble accessing the flow name from within a flow using the context for some reason:
Copy code
Traceback (most recent call last):
  File "/home/aradox/code/wfp/wfp-prefect/utilities/slack.py", line 93, in handled_error_func
    return func(*args, **kwargs)
  File "/home/aradox/code/wfp/wfp-prefect/utilities/van.py", line 213, in alert_new_van_contact
    "flow": get_run_context().flow.name,
AttributeError: 'TaskRunContext' object has no attribute 'flow'
Ah I see, I'm getting a task run context instead of a flow run context
z
Hey! Task runs don’t have access to the flow because they may be running on other workers
You can use
FlowRunContext.get()
instead though if you’re always running your tasks locally
a
Awesome
that's perfect