I wanted to apply an object operator (shade_smooth/flat) to linked/dupli objects, but can't find a way to pass the object to this operator.
import bpy
# flat or smooth
flat = False
for ob in context.scene.objects:
if ob.dupli_group and ob.dupli_group.objects:
for dob in ob.dupli_group.objects:
if flat:
bpy.ops.object.shade_flat()
else:
bpy.ops.object.shade_smooth()
Of course this doesn't work, because it applies on selected objects only. Was surprised to see this even works from the python terminal, without the need to override context.
Any clues?