I am trying to automate packaging of layer and other files to a .zip for sharing. This works fine for layers in the map using arcpy.management.SaveLayerToFile(),However this does not work when passing a table.
Outside of Python I can right click on a standalone table in the content pane, and use Sharing > Save As Layer File. This works as expected and creates a .lyrx with the standalone table. Can I replicate this function using Python?
As an example I have attempted the following which returns the error 'The value is not a layer'
import arcpy
project = arcpy.mp.ArcGISProject(<path to project>)
map = project.listMaps()[0]
table = map.listTables()[0]
arcpy.management.SaveToLayerFile(table,<path to lyrx>)
Is there another function to save a table to a lyrx? or can I reference the table in another way so that .SaveToLayerFile will accept it?
Cheers!