I have 3 layers in the TOC in QGIS. I want to refresh the layers in the TOC to see what layers are present. Because, when I am executing the following code, I am not getting the layers present in QGIS.
layers = canvas.layers()
So I want to refresh the layers present in the TOC and check. How can I do that in QGIS?