[Qgis-developer] Making QgsProject available to python plugins

Sandro Santilli strk at keybit.net
Sat Sep 29 05:45:10 PDT 2012


On Sat, Sep 29, 2012 at 02:36:37PM +0200, Sandro Santilli wrote:
> On Sat, Sep 29, 2012 at 03:32:58PM +0300, Alexander Bruy wrote:
> > AFAIK, QgsProject already available from Python. Just use
> > QgsProject.instance() to access it. Maybe you mean that
> > some methods currently not exposed in Python API?
> 
> NameError: global name 'QgsProject' is not defined

Fixed by:

 from qgis.core import *

Now what I'm after is adding each of the layers defined in one project
into another one. Would "createEmbeddedLayer" do that for me ?
I do know the names of each layer in the source project.

--strk; 


More information about the Qgis-developer mailing list