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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.