Update deck overview after import

I modify a collection with add_note/update_note/remove_notes in the background. How can I update the deck overview after a successful import so that it displays the new number of cards?

Best practice is to use the CollectionOp wrappers in aqt.operations so that affected screens are automatically refreshed for you.

If you’re not able to use CollectionOp for reasons such as wanting to support older Anki versions, adding a call to .mw.reset() will probably work.

1 Like

I have overread that.

I opted for mw.reset() because CollectionOp does not have a success handler and I want to display a summary of the changed objects at the end of the operation. Thanks for the hint!

You can pass a success handler to the .success() method:

Thanks! I will give it another try.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.