简体   繁体   中英

How to run QGIS plugin from python script

I would like to access external qgis plugins through a python script. I have been able to access the built in qgis processing and vector toolboxs, but have been unsuccessful with external plugins such as the topology checker plugin. I have tried this both using the built in qgis python console, and an exteranl IDE, but attempts have failed.

I am sure that there is a way to do this, has someone done this before?

Thank you!

You could add the qgis plugin folder to your path. That way you should be able to import them as a module.

Have a look at my blog to find a way to load QGIS plugins in a standalone PyQGIS application (in Spanish):

http://geotux.tuxfamily.org/index.php/en/component/k2/item/229-cargando-plugins-de-quantum-gis-en-el-visor-de-pyqgis

在此处输入图片说明

There you'll find a QgisInterface class, which you must use to be able to run plugins out of QGIS. This class is now being employed by QGIS devs to run PyQGIS tests.

As you can se, the blog post is very old, so I don't warrant it'll work out of the box, but for sure it's a very good guide for you to accomplish what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM