<@ULVA73B9P> in the old version 1 of prefect it wa...
# ask-marvin
c
@Marvin in the old version 1 of prefect it was possible to call
prefect.context.get("my_variable")
to get a variable handed over via the UI. What can I use in version 3 to do the same?
m
In Prefect 3.x, you can manage and access variables through the Prefect UI, API, CLI, and directly in your Python code. To access these variables in your code, you can use the Prefect Python SDK's methods for interacting with variables. Here's how you can retrieve a variable's value in Python:
Copy code
python
from prefect import variables

value = variables.get("my_variable")
This method allows you to access variables that are set in the Prefect UI or through other interfaces like the CLI. For more information, you can refer to the Prefect 3.x documentation on variables.