[Qgis-developer] Calling functions in C++ plugin from python

Martin Dobias wonder.sk at gmail.com
Wed Feb 13 12:23:49 PST 2013


On Tue, Feb 12, 2013 at 3:12 PM, Angus Carr <angus.carr at gmail.com> wrote:
> Hi, all.
> Is there a way to call a C++ plugin function from a python plugin?
> I have a python plugin that I want to have do something that is already
> implemented in one of the C++ plugins.

You shouldn't try to do that - plugins are simply not designed for
that. There are various reasons why this would be a bad idea (e.g. no
public API, binary compatibility problems and different handling of
plugins across platforms).

If any QGIS c++ plugin contains some code that is worth using in other
plugins, it makes sense to move such code to QGIS libraries and
generate python bindings. Like this, calling c++ code from python is
safe and free of headaches.

Martin


More information about the Qgis-developer mailing list