I have a script that generates scenes after each iteration is completed I delete all the mesh properties but still not all the data has been deleted. Is there any convenient way to reset blender scene to it's default state, using script? (like when you open Blender)


You can load the default startup file using bpy.ops.wm.read_homefile(). This operator also allows you to load application templates if you use the optional app_template argument. Be aware that the current .blend project file will not be saved automatically, meaning all unsaved state will be lost.

The problem with loading the default startup file or any project for that matter, is that currently running scripts will be stopped in their execution and handlers freed. Unless you registered a persistent handler that runs after the project is loaded you won't be able to resume the execution of your script.

| improve this answer | |
  • $\begingroup$ Ok now I can see the problem. So how can I "reset" the scene without stopping the execution? My problem is that I try to render a number of scenes automatically but from the second animation I have a difference between the rendered animation and what I see in the GUI and I think it has something with the way I'm cleaning the scene after each iteration. $\endgroup$ – AvivSham Oct 12 '19 at 12:33
  • $\begingroup$ That would be easier to answer when we know what differences you are experiencing. $\endgroup$ – Robert Gützkow Oct 12 '19 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.