modelx.get_models#
- get_models()[source]#
Get all models as a dictionary.
Returns a dictionary mapping model names to their corresponding
Modelobjects. This includes all models that have been created in the current Python session and haven’t been deleted.- Returns:
Dictionary with model names as keys and Model objects as values.
- Return type:
Example
>>> import modelx as mx >>> >>> m1 = mx.new_model('Model1') >>> m2 = mx.new_model('Model2') >>> >>> models = mx.get_models() >>> models {'Model1': <Model Model1>, 'Model2': <Model Model2>} >>> >>> # Access specific model >>> models['Model1'] <Model Model1>
Note
In Python 3.7+, you can also access models via the
modelx.modelsattribute or directly asmodelx.ModelName.See also
new_model(): Create a new modelcur_model(): Get or set the current modelread_model(): Load a model from filesmodelx.models: Attribute for accessing models dictionary