Due to a clip-batchprocess and the tool "package layers" I end up with a geopackage with several layernames that start with "clip_". I would like to trim all the layernames by the first 5 characters instead of manually changing all the layernames. How can I do that?
I tried to use the following expression in the python console:
layerList = QgsProject.instance().layerTreeRoot().findLayers()
for layer in layerList:
basename = layer.name()
layer.setName(basename.replace("clip_",""))
But it doesn't work for me. The layer names don't change.



