I am trying to load a layer from an mxd and back up the layer using ArcGIS Pro and Python.
mlist = aprx.listMaps()
infra_layers = mlist.listLayers()
new_file_name = backup_geodatabase_path + 'ActiveInfraProjects.lyrx'
arcpy.SaveToLayerFile_management(infra_layers.name, new_file_name, 'ABSOLUTE')
#I get the following error:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Layer: Dataset active_infrastructure_projects does not exist or is not supported
Failed to execute (SaveToLayerFile).
#It says it doesn't exist but I was able to get the name from the file (infra_layers) so it must exist.
#Why is it not supported?