Run Function on Scene Created

Basically I want my code to run every time I create a scene. I know that the messagebus system is probably the way to go, but I can’t get it to work. I can detect when the active scene is changed like this:

def callback_scenechange():
  print("changed Scene")

owner = object()
subscribe_to = bpy.types.Window, "scene"


But this does not trigger whe I create a NEW scene.
Help would be appreciated :slight_smile:

I did not try this but maybe use

def callback_scenechange():
  print("changed Scene")

There are also
on loading a new blend file (after)
on loading a new blend file (before)

thanks but this doesn’t trigger when creating a new scene - just when loading a blendfile.

closing this because I decided to go with viewlayers instead (carries the same problems though)

Interesting. In theory, a new scene is just loading the default scene.