I have a script that adds layer files to a map and optionally saves it. If the map is open, I just reference the map like normal, i.e. mxd = arcpy.mapping.MapDocument("CURRENT").
I'd like to be able to check whether the map is open in the first place, so I can reference the map through a parameter if it isn't.
What I've come up with so far is to use a try/except block to catch the runtime error generated if the mxd is not open, then set it to a default if so.
Is there a way to check if the map is open or not? Thanks.