modelx.get_object#
- get_object(name: str, as_proxy=False)[source]#
Get a modelx object by its full dotted name.
Retrieves a modelx object (model, space, cells, or reference) using its complete dotted name path. This is useful for accessing objects programmatically when you have their string representation.
- Parameters:
- Returns:
The requested modelx object.
- Raises:
AttributeError – If the object doesn’t exist.
Example
>>> import modelx as mx >>> >>> m = mx.new_model('MyModel') >>> s = m.new_space('MySpace') >>> c = s.new_cells('foo', lambda x: x * 2) >>> >>> # Get objects by name >>> mx.get_object('MyModel') <Model MyModel> >>> >>> mx.get_object('MyModel.MySpace') <UserSpace MyModel.MySpace> >>> >>> mx.get_object('MyModel.MySpace.foo') <Cells MyModel.MySpace.foo(x)>
See also
get_models(): Get all models