For referenced feature layers brought into AGO from our enterprise server I can access the sourceUrl using item.sourceUrl. Is it possible to also update the sourceUrl?
I'd like to point the referenced feature layer at a different REST URL to update the underlying data without creating a new item and losing popup configuration, etc.
I've not tested this, but assuming the schema is exactly the same then you should be able to do this for your specific case (i.e., you added Enterprise Feature Services as items to your AGOL content).
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "user", "passwd")
new_url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RedlandsEmergencyVehicles/FeatureServer"
your_item_id = "4567fd6780e74ccb877fasdfghjlkl"
item = gis.content.get(your_item_id) # here the item id of the Feature Service you added to AGOL
item_properties = {"url": new_url}
item.update(item_properties=item_properties)
Coding this may not be worthwhile for a few urls. As Jake mentioned, you can do the same thing rather quickly in AGO Assistant.