Skip to main content
Angreal Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Get Context

get_context() -> dict:

get the context that was used to render the original template, returns an empty dictionary if no angreal.toml is found

import angreal

# Get the context as a dictionary
context = angreal.get_context()

# Example: Accessing values from the context
if context:
    print("Project name:", context.get("project_name", "Not set"))
    print("Version:", context.get("version", "Not set"))

# Example: Setting a new value in the context
context["new_key"] = "new_value"
print("Updated context:", context)