3

How do I stop the execution of plugin or deactivate the running plugin using plugin name without closing QGIS in pyqgis?

lstofplugins=qgis.utils.active_plugins
for k in range(len(lstofplugins)-2):
    self.iface.actionExit().trigger()

I have tried this coding ,but it is closing QGIS application itself..

1

You could try unloading the plugin:

qgis.utils.unloadPlugin('GdalTools')
1

This is automatically coded when I built my plugin with QGIS Plugin Builder:

def onClosePlugin(self):
    """Cleanup necessary items here when plugin dockwidget is closed"""
    # disconnects
    self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
    self.pluginIsActive = False

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.