I'm creating a script to process all layers in an ArcGIS Pro project but would only like it to process maps that the user has open in the current project and not all maps associated with the project.
aprx = arcpy.mp.ArcGISProject("CURRENT")
maps = aprx.listMaps()
for map in maps:
layers = map.listLayers()
for layer in layers: If I was looking at data sources for example, the above code would process layers in all maps even if they aren't currently open.
How would I only process layers in open maps only?