I have two layers that I want to remove using PyQGis as part of a larger script. The first layer I can removed using:
QgsMapLayerRegistry.instance().removeMapLayer( shp.id() )
However, it seems that the second layer (the Joined layer) cannot be removed in the same way as I get the following error:
QgsMapLayerRegistry.instance().removeMapLayer( result.id() )
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: JoinAttributes instance has no attribute 'id'
Does anyone happen to know a way to remove the Joined layer with PyQGIS?