I'm trying to change the data source of a QgsRasterLayer to point to a different URI.
I can change the dataProvider's datasource with
wmsLayer.dataProvider().setDataSourceUri(uri) and the change is correctly shown.
But as it's just changing the dataProvider the change is not saved and will default back on reloading the project.
wmslayer.source() also still returns the old source.
There is a
QgsRasterLayer::setDataSource() function, but it doesn't appear to have a python binding.
How would one go about changing it correctly?