Example Code
————
layername1 = 'Imagery Orthophoto 2014' url1 = 'contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/jpeg&layers=0&styles&url=https://eservices-test.dls.moi.gov.cy/arcgis/services/BASEMAPS/Imagery_Satellite_2009_2013/MapServer/WMSServer' layername2 = 'Imagery Orthophoto 1963' url2 = 'contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/jpeg&layers=0&styles&url=https://eservices-test.dls.moi.gov.cy/arcgis/services/BASEMAPS/Imagery_Orthophoto_1963/MapServer/WMSServer' layer = QgsRasterLayer(url1, layername1, 'wms') layer2 = QgsRasterLayer(url2, layername2, 'wms') QgsProject.instance().addMapLayer(layer2) QgsProject.instance().addMapLayer(layer)