Hook during close of Anki

Hello,

is there any hook which will be initiated every time when user profile will be unloaded or Anki is being closed?

There seems to be:
Hook(name="profile_will_close", legacy_hook="unloadProfile")
but it is written:

Called before one-way syncs and colpkg imports/exports.

Source: anki/qt/tools/genhooks_gui.py at main · ankitects/anki · GitHub

but it is not triggers during the regular close of application.

1 Like

You’re reading the docs for the wrong hook.

I know ;). I just wrote info about this hook so that someone wouldn’t give me it
without even reading it.

Are you sure?

2 Likes

I have not tried it, maybe if you use gui_hooks.state_did_change and if new_state == "profileManager" it might work?

1 Like

Tested again and worked - thanks :slight_smile:

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