For arcpy.mp Maps
arcpy.mp.ArcGISProject("CURRENT").listMaps()and Layouts
arcpy.mp.ArcGISProject("CURRENT").listLayouts()add an isOpen boolean property.
Use case:
layout = arcpy.mp.ArcGISProject("CURRENT").listLayouts('My Layout')[0]
if not layout.isOpen:
layout.openView()Without this, if the user runs the script multiple times, they get multiple views of the layout.
See also: https://community.esri.com/t5/python-questions/listing-open-maps-only-in-an-arcgis-pro-project/td-p/1118592