Hi! I have a Map Image Layer (MapServer) stored on our Portal. This needs to update weekly, so I'm trying to figure out how to update this using python. The tool I use to update is called "Overwrite Web Layer". Unfortunately, this is not a geoprocessing tool, so there is no python command.
I've tried exporting map to SD, and then using the SD to overwrite the map image server. That did not work. That code is below.
Any help would be greatly appreciated!

arcpy.server.UploadServiceDefinition(
in_sd_file=r"T:\NRYANGISWKSP\Projects\OpenGov\_FINAL SCRIPT\OpenGov_MAT.sd",
in_server="https://gis.cityofgoosecreek.com/arcgis",
in_service_name="OpenGov_Map_Layers",
in_cluster="",
in_folder_type="FROM_SERVICE_DEFINITION",
in_folder="",
in_startupType="STARTED",
in_override="USE_DEFINITION",
in_my_contents="NO_SHARE_ONLINE",
in_public="PRIVATE",
in_organization="NO_SHARE_ORGANIZATION",
in_groups=None,
in_item_id=None
)