Is there a way to add labels of the added layers using python. I've tried these lines of code but no label shows after execution in QGIS 3.0
for layer in QgsProject.instance().mapLayers().values():
layer.setCustomProperty("labeling/fieldName", "Id" )
layer.setCustomProperty("labeling/placement", QgsPalLayerSettings.Horizontal)
layer.setCustomProperty("labeling/predefinedPointPosition", QgsPalLayerSettings.BottomRight)
layer.setCustomProperty("labeling/fontSize","10" )
layer.setCustomProperty("labeling/bufferDraw", True)
layer.setCustomProperty("labeling/enabled","true" )
layer.triggerRepaint()