How to change bpy.context.scene inside a script?

Hi all,

I’m trying to change the value of bpy.context.scene. I read that

scene =[1][“SceneName”].scene = scene


is supposed to work, but I only noticed the change after the script had finished. I also tried using scene.update() in several places but it didn’t work.

Is it possible to do this?

mynewscene ="MyScene")
context.window.scene = mynewsene

Do you mean



That works for me, so thank you! Any idea why that would work but screens[“Name”].scene wouldn’t?

I was assuming we are talking about 2.80. So I meant what I told you.
In 2.79 what you do is
bpy.context.screen.scene = scene

Yes, you are trying to pick a screen via a scene name.

Just do this, if you have to pick it by name:[“SceneName”]
or better“SceneName”)

1 Like