State.access#

State.access(key: str, initializer: Any = 'throw error if missing') Any#

Raw access to values stored in this state’s context.

This method short-circuits all of ActivitySim’s machinery to provide or build missing context values automatically – only values already stored can be accessed.

Parameters:
keystr

The name of the variable to access.

initializerAny, optional

If the variable is not already in the state’s context, it will be set with this value, or if it is not provided a KeyError is raised instead.

Returns:
Any