# First create an ArcGIS Pro Project, with at least one template, and put the # name of it below. import arcpy TEMPLATE_NAME = "Square" aprx = arcpy.mp.ArcGISProject("basic.aprx") for lyt in aprx.listLayouts(): if lyt.name == TEMPLATE_NAME: # export! print(f" {lyt.name} ({lyt.pageHeight} x {lyt.pageWidth} {lyt.pageUnits})") lyt.exportToJPEG("out.jpg")