I need a list containing the names of all the layers in a QGIS session. I did the task as
layersNames = []
for i in self.iface.mapCanvas().layers():
layersNames.append(str(i.name()))
but this has the problem that only the names for the visible layers are extracted. How can I get a list with the names of all (visible or not) layers using PyQGIS?