Skip to main content

get_template_attribute

Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code.

def get_template_attribute(
template_name: str,
attribute: str
) - > t.Any

Loads a macro (or variable) a template exports. This can be used to invoke a macro from within Python code.

Parameters

NameTypeDescription
template_namestrThe name of the template to load the attribute from.
attributestrThe name of the variable or macro to access within the template.

Returns

TypeDescription
t.AnyThe loaded macro or variable from the template.