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.