I have written a python script to batch export several pdfs from a single mxd, switching layers on/off and naming the output pdf based on values supplied by the user in a csv file. We import the required datasets into a template mxd I've set up containing pre-named groups and the company sidebar. The template has a large data frame in the centre of the page for the main data and a smaller "inset map" data frame in the sidebar below the legend to show the datasets' position relative to known geographic locations. The geographic location of the main data frame is shown in this inset map.
The issue we're having is that the first pdf export behaves as expected, but the inset map in the rest of the exports shows a larger "main data frame" extent than it should. I've attached two images to illustrate what we're seeing.
The python script is quite long (as it's part of a larger toolset script), but if you need to see it I can add it (though all it does is read a csv, switch layers on/off and export as pdf - no scaling or moving dataframes).
Do I need to refresh / regenerate some values before each export?