How to run a script outside Playmode?

I programmed a script(c#), which creates a scene in Playmode that i want to save, with the result that the created scene won’t be deleted after quitting Playmode . I realized , that this is not possible without spending money. Now I’d like to run the script, which creates the level, outside Playmode, so that i can save the Scene. But i don’t know if this is even possible. Is there a way to do that?
Thanks in advance! :wink:

For running scripts outside of play mode use the [ExecuteInEditMode] Attribute: