Reload start-up file while keeping script running

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Wed Jun 26, 2013 4:19 pm

Reload start-up file while keeping script running

Post by BillCheatham »

I am trying to use Python to programatically reload the Blender start-up file (equivalent to pressing Cmd+N).

I have tried using the command:

Code: Select all

However, this also reloads the currently running Python script. While the script appears to try to run until completion, certain operations are no longer working. In addition to the script window reloading the default script, I am getting 'incorrect context' errors from running the rest of the script:

Code: Select all

RuntimeError: Operator bpy.ops.wm.collada_import.poll() failed, context is incorrect
Bus error
I have attempted other ways of clearing the scene, for example deleting all objects in it. However, I wish to also change the settings such as lighting and render settings back to their defaults.

As some background, I wish to reload the scene from scratch as I am importing .dae files. These bring with them strange changes to the scaling, lighting and units of the scene, which I wish to reset after each object has been imported and rendered.

Many thanks for any advice anyone is able to offer...

Post Reply