write_model#

pharmpy.modeling.write_model(model, path='', force=True)[source]#

Write model code to file

An updated Pharmpy model is returned. This will have a new name based on the filename and it might have updates to the model code (e.g. for $DATA in NONMEM models).

Parameters:
  • model (Model) – Pharmpy model

  • path (str) – Destination path

  • force (bool) – Force overwrite, default is True

Returns:

Model – Updated Pharmpy model

Example

>>> from pharmpy.modeling import load_example_model, write_model
>>> model = load_example_model("pheno")
>>> write_model(model)