sorry for rising this question again. The solution above works fine to change the scen.
BUT i have not found any way to make the python script actually work on the scene were it changed to.
This scrip part should:
1 Step) change from any current scene (for exampe Scene.001) to the scene named “Scene”.
2.Step) render the scene were it change to. In this case “Scene”
for some reason this example first render the wrong scene (scene.001) and then changes to the scene i wanted to go.
is there a way to render a scene without making it current before?
To clarify: I’m looking to do the exact same thing as brino, to render multiple scenes in a .blend file via python. So I need to change the scene, and then call bpy.ops.render.render(), but the render call doesn’t work on the new (second) scene - it just renders the first scene again and again.
I found a strange behavior that may be related to this problem: When I change scenes from “Scene1” to “Scene2” by calling
for scr in bpy.data.screens:
print(scr.scene.name)
… the other screens (for example, the modeling screen, or the compositing screen) have not changed over to the new scene. The same thing happens if I switch screens via the GUI - for example, if I change from “Scene1” to “Scene2” while in the modeling screen, and then I switch to the compositing screen, Blender will switch back to “Scene1” on me.
I tried to set all the screens to the same scene using a for loop:
for scr in bpy.data.screens:
scr.scene = bpy.data.scenes[‘Scene2’]
… but it did not work. When I checked the screens later with:
for scr in bpy.data.screens:
print(scr.scene.name)
… only the active screen had changed to the new scene. It seems to me that ALL the screens should always be associated with the same (active) scene - is this a bug in the API? Any chance of a fix? Or is there anything else I can do?