I am trying to find a way to export a layer in a QLR file in PyQGIS. I want to do the same as right-click and export to layer definition file.
I know that I have to use
QgsLayerDefinition.exportLayerDefinition and it needs a
QgsLayerTreeNode parameter. But I don't know the steps to take a
QgsVectorLayer and put it in a
I also need to do the reverse, load a QLR file and show the layer in QGIS.