When running a geoprocessing script from the ArcGIS Python window or a custom script tool, you will often need to get a reference to the map document currently loaded in ArcMap. This is typically the first step in your script before you perform geoprocessing operations against layers and tables in a map document. In this recipe, you will learn how to reference the current map document from your Python geoprocessing script.
Before you can actually perform any operations on a map document file, you need to get a reference to it in your Python script. This is done by calling the
MapDocument() method on the
arcpy.mapping module. You can reference either the currently active document or a document at ...