For example, when the custom addon is loaded, the value of bpy.context.scene.world.use_sky_paper is expected to be True, where its default value is False in blender.

Setting it in UI (the draw function) will cause an error, while writing an operator to set it will need users to toggle it explicitly. Can I have the behavior that the default value is True when blender is first opened. Thanks.

  • 1
    $\begingroup$ Something like blender.stackexchange.com/a/23230/15543 .... setting up an onload handler to set world.use_sky_paper = True ?? $\endgroup$
    – batFINGER
    Commented Jun 1, 2017 at 14:21
  • $\begingroup$ @batFINGER while the thought was to enable it when the addon is enabled, a persistent on file load handler would be a better idea. $\endgroup$
    – sambler
    Commented Jun 1, 2017 at 14:29
  • $\begingroup$ Actually both would need to be setup, the load_post handler doesn't alter the existing file. $\endgroup$
    – sambler
    Commented Jun 1, 2017 at 14:35

1 Answer 1


A way of automate it could be to use an Application Handler, I think one of the scene update handlers would be the best fit. As you only want to alter the value once I would have the handler remove itself once it has done it's task.

As batFinger pointed out, it would also be useful to setup a persistent handler that will set the value when another file is loaded.

bl_info = {"name": "Set property", "version": (1, 0), "location": "blender",
    "description": "Test a way of setting a default property.",
    "warning": "Only testing", "category": "Test",

import bpy
from bpy.app.handlers import persistent

def setIt(scene):
    scene.world.use_sky_paper = True

def register():

def unregister():

if __name__ == "__main__":

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .