I have been trying to automate the map production in ArcGIS Pro 2.9.1
There is a point in the production where it has to turn on and off some of the elements in the layout and I figured how to do it as well.
this is the code I'm using:
am_lyt=lyt.listElements(wildcard="Name_of_the_table")[0]
print(am_lyt.visible)
am_lyt.visible=True
print(am_lyt.visible)
This gives the result:
False
True
But the table is not turning on and there's no error either. Surpisingly, when I executed the below code, I could see the action on the layout, its just the visibility not working
mf.camera.setExtent(mf.getLayerExtent(sitelyr, False, True))
print ("x")
I tried using the CIM:
cim_lyt=lyt.getCIM()
but this line of code is not executing, so I tried the below:
cim_lyt=lyt.getDefinition('V2')
Sadly getDefinition kept giving me it has to attribute error.
Does anyone know how to resolve this?