Change properties for multible Objects

Hello,

Im trying to write a little script wich changes the ray visibility property of all objects I seleted. Im new in this area of Blender and I dont know much of scripting with Phyton, but I`ll be pleased about learning how it works.

This is the code I want to run, but nothing happens:

import bpy

def main(context):
    for obj in context.selected_objects:
        bpy.data.objects.cycles_visibility.camera = false

Thank you
Theo11

try this

import bpy
for obj in bpy.context.selected_objects:
    obj.cycles_visibility.camera = False

Yes it works! Thank you :smiley:

you only defined the function main, but there is no call to it.

either make this an operator (see the templates) or do it like this:

import bpy

for ob in bpy.context.selected_objects:
    ob.cycles_visibility.camera = False