State.get#
- State.get(key, default: Any = 'throw error if missing') Any #
Automated access to values stored in this state’s context.
This method takes advantage of ActivitySim’s machinery to provide or build missing context values automatically. If a value is already present in this state’s context it is returned, otherwise the set of defined methods for loadable objects and tables will be used to create values if possible.
- Parameters:
- keystr
The name of the variable to access.
- defaultAny, optional
If the variable is not already in the state’s context, and cannot be otherwise created automatically, it will be set with this value, or else a KeyError is raised instead.
- Returns:
- Any