I am trying to use the CIM definition on a query layer to set it to use its own metadata. This causes the layer to get disconnected. The code is along the following lines
arcpy.management.MakeQueryLayer(..paras..)
arcpy.management.SaveToLayerFile(layername, layerfile, "ABSOLUTE")
layer = map.addLayer(arcpy.mp.LayerFile(layerfile), "BOTTOM")[0]
l_cim = layer.getDefinition('V2')
l_cim.useSourceMetadata = False
# This causes the layer to become disconnected, regardless of whether any properties were set on the
#CIM definition
layer.setDefinition(l_cim)
Can anyone offer any suggestions?
Thanks,