I am trying to access the world shading settings in python.
I want to enable ambient occlusion and give it a value of 0.5. I have tried:


But I didn't work.


1 Answer 1


To turn Ambient Occlusion on you must set its value to True. What you are doing wrong is that you are trying to execute the function use_ambient_occlusion() which does not exist because it's variable not a function.

import bpy
bpy.context.scene.world.light_settings.use_ambient_occlusion = True  # turn AO on
bpy.context.scene.world.light_settings.ao_factor = 0.5  # set it to 0.5

You must log in to answer this question.

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