How to "reload" models after col.models.add()


I create a new model like this

models = col.models
model =

models.add_field(model, models.new_field(...))
model['css'] = ...

template = models.new_template(...)
template['qfmt'] = ...
template['afmt'] = ...
models.add_template(model, template)


the model is created fine and shown in Tools->Manage Note Types but it is not found in the model manager yet (restarting Anki fixes this of course). I found the hint “Notetype needs to be fetched from DB after adding.” in add_dict() but how should I do that?

.add_dict() returns the id, which you can pass in to .get()

Thank you very much! Turns out I had a very dump screw up in the caching mechanism of the model_id_by_name wrapper function of mine :frowning: Sorry for that, now everything works fine and I can continue on.
Thanks for your help!