Is it possible to listen for plugin removal before the plugin is removed?

We save global settings as user interacts with the plugin, but want to reset plugin specific global settings when user uninstalls the plugin.


You can use the unload() method of your plugin, which is called also when your plugin is uninstalled.

So, the best place to do your cleaning is there, the unload().

See What is the purpose of some functions and files in QGIS Python plugins? for details.

  • This seems to invoke when I close QGIS client as well. I want a signal when plugin is uninstalled, not necessarily when plugin is unloaded. – James Park Jul 22 '20 at 5:04
  • 1
    Then, it doesn't exist. There will always be edge cases, like a user removing the plugin folder manually in the file explorer. You simply won't be able to react to such case. Anyways, I'd suggest you to think again about/adjust your implementation, or, to create a feature request for QGIS. – Germán Carrillo Jul 23 '20 at 14:54
  • Thank you for clarification. – James Park Jul 23 '20 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.