I need to be able to switch scenes in python code while in game, and I don't mean hooking up a python controller to a scene changing actuator, I need to be able to change scenes without it. Does anyone know how it would be done?

  • $\begingroup$ What are the reasons why you think you "...need to be able to change scenes without it." $\endgroup$
    – Monster
    Aug 3, 2016 at 5:42

2 Answers 2


It does exist in the API, the trick is you have to get the scene first:

for scene in bge.logic.getSceneList():
    if scene.name == 'oldSceneName':

API: https://www.blender.org/api/blender_python_api_2_78a_release/bge.types.KX_Scene.html#bge.types.KX_Scene.replace

Another useful 'replace scene' like thing that I have done quite a lot is to end the current scene(s) and then add the new one:

for scene in bge.logic.getSceneList():

The BGE API (version 2.77) does not support to switch scenes without an actuator.

The scene actuator is sufficient enough.

  • You will never be able to switch to more than one scene. [dynamic number of switches]
  • You already can dynamically setup the scene to switch to. [dynamic calculation of the target scene]
  • A scene switch will always performed AFTER the current frame (after the actuators where processed). [timing]


You can dynamically add overlay/background scenes via addScene(). This is to add several scenes within a single frame without the need to know the number of scenes beforehand. (Otherwise you need n actuators for n scenes to add).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .