Hello everybody,
I want to create an extent indicator by using arcpy. Here is an example how it should look like:

I know I have to use CIM for the solution but I have difficulties understanding the documentation.
Here is the code snippet I have tried out so far. As a result, no extent indicator is displayed at all. I have also swapped both map frames with each other and assigned ei_cim.sourceMapFrame = mf_main instead of ei_cim.sourceMapFrame = mf_main.name, but it doesn't help:
# Extent Indicator wird gesetzt
lyt_cim = lyt.getDefinition('V2')
ei_cim = arcpy.cim.CreateCIMObjectFromClassName('CIMExtentIndicator', 'V2')
ei_cim.sourceMapFrame = mf_main.name
ei_cim.extentIndicatorType = "Frame"
ei_cim.isVisible = True
ei_cim.name = "extent_indicator"
lyt_cim.elements[7].extentIndicators.insert(0, ei_cim)
lyt.setDefinition(lyt_cim)lyt_cim.elements[7] is the second mapframe element.
What am I doing wrong?