I often have to reload layers in the layers panel after doing changes in the DB-Manager (add a column, delete a default value, ...). At the moment I use the changeDatasource plugin. Can this also be done using Python?
if you have your layer as a variable, simply
You can obtain a list of all layers of the current project from
If you don’t care about reloading all other layers at the same time, the one-liner
does the job, too.