Still no luck.Interestingly, the RemoveLayer command won't work once the layer is added either. There seems to be something wrong with the way I am adding the layer to the mxdI finally got it to work, but in a really round-about way.# Import arcpy module
import arcpy
# Set Geoprocessing environments
arcpy.env.workspace = "**************"
##overwrites output
arcpy.env.overwriteOutput = True
#mapDocument
mxd = arcpy.mapping.MapDocument(r"***********************.mxd")
#setting layer variable
nl = arcpy.mapping.Layer(r"*****************************.lyr")
##setting dataset variable
df = arcpy.mapping.ListDataFrames(mxd)[0]
#select layer
arcpy.SelectLayerByAttribute_management(nl, "NEW_SELECTION", ' "***************" ')
#set scale
df.scale = 7000000
##adds layer variable to mxd
arcpy.mapping.AddLayer(df, nl)
##zooms to layer
df.zoomToSelectedFeatures()
extent=df.extent
for nl in arcpy.mapping.ListLayers(mxd, "", df):
arcpy.mapping.RemoveLayer(df, nl)
arcpy.RefreshActiveView()
#mapDocument
mxd = arcpy.mapping.MapDocument(r"***************************.mxd")
nl2= arcpy.mapping.Layer(r"**********************************")
##setting dataset variable
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.extent=extent
##adds layer variable to mxd
arcpy.mapping.AddLayer(df, nl2)
##exports current map extent to png
arcpy.mapping.ExportToPNG(mxd,r"************************",df,df_export_width=550,df_export_height=480)