I want to shade smooth an object by its name ('Cube' for example). This is how I would do it but it doesnt work.
import bpy
bpy.ops.object['A'].shade_smooth()
I want to shade smooth an object by its name ('Cube' for example). This is how I would do it but it doesnt work.
import bpy
bpy.ops.object['A'].shade_smooth()
Blender 3.2 + :
with bpy.context.temp_override(selected_editable_objects=[bpy.data.objects["A"]]):
bpy.ops.object.shade_smooth()
Previous versions :
bpy.ops.object.shade_smooth({"selected_editable_objects": [bpy.data.objects["A"]]})
Note the argument must be a list or at least an iterable of mesh objects.
For a more comprehensive list of operator overrides, see https://blender.stackexchange.com/a/248275/86891