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

**URL:** <https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179>\
**Category:** Development\
**Created:** [March 9, 2022, 9:01am UTC](https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179 "2022-03-09T09:01:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raph](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@raph](https://forums.ankiweb.net/u/raph)\
**Post date:** [March 9, 2022, 9:01am UTC](https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179/1 "2022-03-09T09:01:43Z")

</div>

Hello,

I create a new model like this

```auto
models = col.models
model = models.new(name)

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

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

models.add(model)

```

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?

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [March 9, 2022, 11:33am UTC](https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179/2 "2022-03-09T11:33:43Z")

</div>

.add\_dict() returns the id, which you can pass in to .get()

---

<div class="post-metadata">

**Author:** ![raph](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@raph](https://forums.ankiweb.net/u/raph)\
**Post date:** [March 9, 2022, 9:35pm UTC](https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179/3 "2022-03-09T21:35:53Z")

</div>

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 ☹ Sorry for that, now everything works fine and I can continue on.  
Thanks for your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 3:16am UTC](https://forums.ankiweb.net/t/how-to-reload-models-after-col-models-add/18179/4 "2023-05-01T03:16:16Z")

</div>

Closed on May 1, 2023, 3:16am UTC


