Error trying to set only active object's origin with others selected
Override the context.
There is no origin_set belonging to an Object.
There are a couple of ways to do this, either deselect all other objects before calling the origin set operator, or override the context to make the selection only the single (or chosen) object(s)
Am using the python console, which is a great place to nut things out.
With  &quot;Cube&quot; active, and the &quot;Cone&quot; and &quot;IcoSphere&quot; selected...
&gt;&gt;&gt; C.object
bpy.data.objects['Cube']

&gt;&gt;&gt; C.selected_objects
[bpy.data.objects['Cube'], bpy.data.objects['Icosphere'], bpy.data.objects['Cone']]

Make an override dictionary, telling blender the only object to re-origin-ate is the &quot;Cube&quot; by making it the only member of context.selected_editable_objects &lt;- The selected objects that the operator uses.  Why cannot I override the context for bpy.ops.object.origin_set()
&gt;&gt;&gt; c = {}
&gt;&gt;&gt; c['active_object'] = None
&gt;&gt;&gt; c['selected_editable_objects'] = [C.object]
&gt;&gt;&gt; c
{'active_object': None, 'selected_editable_objects': [bpy.data.objects['Cube']]}

Run the operator with that context dictionary c as the first argument.
&gt;&gt;&gt; bpy.ops.object.origin_set(c, type='ORIGIN_CURSOR')
{'FINISHED'}

and only the origin of the active object is set.
The error in your question relates to the Object
not having an origin_set property.
&gt;&gt;&gt; C.object.origin_set
Traceback (most recent call last):
  File &quot;&lt;blender_console&gt;&quot;, line 1, in &lt;module&gt;
AttributeError: 'Object' object has no attribute 'origin_set'