ethoms

setting MapDocument.activeView causes existing layers to disappear

Discussion created by ethoms on Mar 25, 2011
Latest reply on Aug 22, 2011 by jbarrette-esristaff
I have one mxd with two data frames ['Layers', 'New Data Frame'] with layers in them. If Layers is active and I use the lines below in the command line window:

mxd = arcpy.mapping.MapDocument('Current')
df = arcpy.mapping.ListDataFrames(mxd, 'New Data Frame')[0]
mxd.activeView = df


New Data Frame is made active and I see the layers.

If use the same commands in a geoprocessing script, the layers are removed from the data frame before it is made active.

Does anyone know what's going on?

Outcomes