UserSpace.update_module

UserSpace.update_module(old_module, new_module=None)

Update an user-defined module assigned to References

Update an user-defined Python module created by new_module(). The new_module parameter is a path to the source file of a new user-defined module. If new_module is not given, the old module is reloaded from the same source file of the old module and a new module module is created.

The values of References referring to the old module object are replaced with the new module object.

If old_module is assigned to multiple References in a model, the value of all the References are updated, even the References are defined in different locations within the model.

This method associates to the new module the ModuleData object previously associated to the old module.

This method is available for Model and UserSpace. The method performs identically regardless of the types of calling objects.

Parameters
  • old_module – A user-defined Python module object.

  • new_module – The path to the source file as a str or a path-like object.

New in version 0.18.0.