Check how many scenes exist through python?

I’m a bit stuck here, how does one check how many overlay or background scenes to prevent a copy of that scene from showing? When making a pause menu, there should always be 1 instance of the overlay scene, not more. How do I check for this?

getSceneList is what you are looking for.

example:

import bge

scenes = bge.logic.getSceneList()

for scene in scenes:
    if scene.name == 'HUD': # checks if you have a scene named HUD
        # do somthing here