Get active world?

How do I return what World the scene is currently using?

bpy.data.scenes[0].world

or if you actually have a valid scene variable.

current_world = scene.world

The result of world can be None, for instance if you delete the world from the scene. So remember to check for that.


if scene.world != None:
    horizon_color = scene.world.horizon_color

bpy.context.scene.world

Currently using.

Thanks friends!

Could you give me an example of the use for this please.

TheElwolf: what is your question precisely?