class MapLayoutHelper(object): """ A helper object to initialize a project, layout, and a map for easy access. Usage: MapLayoutHelper('CURRENT') Constructor: project - (optional) The path to the ArcGIS Pro project or the text "CURRENT" if you are using an open proejct. The default is 'CURRENT'. layout - (optional) The name of the layout to initialize. The default is 'Template' map - (optional) The name of the map element inside the layout provided. The default is 'Map' """ def __init__(self, project='CURRENT', layout='Template', map='Map'): from arcpy.mp import ArcGISProject self.project = ArcGISProject(project) self.layout = self.project.listLayouts(layout)[0] self.map = self.layout.listElements('MAPFRAME_ELEMENT', map)[0]