I am looking for a way of moving a layer to the top of the layer order once another layer is loaded. Using the following code extracted from this answer I get the error: AttributeError: 'QgsLayerTreeMapCanvasBridge' object has no attribute 'customLayerOrder'
shapeindex = self.iface.mapCanvas().currentLayer()
bridge = self.iface.QgslayerTreeCanvasBridge()
order = bridge.customLayerOrder()
order.inster(0, order.pop(order.index(shapeindex.id())))
bridge.setCustomLayerOrder(order)
I looked into pyqgis3 documentation but it doesn't show more than the function name: QgsLayerTreeMapCanvasBridge