Running code at the end of import

To what file / function would I have to add in order to run a line of code right after the deck has been imported?

Before any deck is imported, or before a specific deck (i.e. a deck that you’re distributing) is imported? Are you developing an add-on?

I am playing around with encryption based stuff, and want to run my encrypt function right after the deck has been imported.

Can you give a little more context?

I am trying to make anki have the ability to import with specifically encrypted decks. In the import function I decrypt the encrypted akpg file (at the very beginning, I figured that part out), and then I would like to re-encrypt those files. In order to prevent messing the process up, I would like to have the encryption part run at the very end of the function.

What function within a file would I have to edit in order to run code right after a deck has been imported?

Didn’t you ask this question in another post? Why the duplicate?


Sorry, was a mistake. Do you have an idea on how to solve my issue?

If you are attempting to implement some sort of DRM, it is futile, as you will be obligated to provide the source code of your modifications, making it trivial for others to undo.


I highly doubt that its gonna be “popular” to the extent that someone is gonna have the willpower to do that. Its for a semi-personal matter.