Accessing Scene with python problems

I am trying to access an overlay scene on top of my main scene, which is currently called “Pilot”. The overlay scene I am adding is called “GUI”.

I add the scene, then I’m trying to access the scene itself. The code I am using is


bge.logic.addScene("GUI", 1)
print(bge.logic.getSceneList())

The output from this is


[Pilot]

Why does printing logic.getSceneList() not print the GUI scene which I have just added? Does it take some time for the Scene to get added and accessible within python? Without it acknowledging the GUI scene, I cannot access it at all.

Any help would be much appreciated. This is really holding me back :frowning:

Yeah, it takes a frame for the scene to be added. The next game frame, the list would be what you expect - the GUI scene and the Pilot scene.

Ok thanks SolarLune, got it sorted now.