webmap_item = gis.content.get(webmap_id)
view_item = gis.content.get(view_id)
# interrogate webmap_item to get a specific lyr to remove
wm = WebMap(webmap_item)
wm.remove_layer(lyr)
wm.update() # success
wm.add_layer(view_item)
wm.update() # partial success, partial fail
# item is added but as individual layers in reverse order
The result of line 7 is that each layer contained in the view gets added to the WebMap individually in reverse order, not as a single GroupLayer.
I would like to add the hosted feature layer view as a single GroupLayer to the WebMap.
TIA