make the saving to python a method of the model, called with callbacks