I like to create some automation in Python on a library override of a linked collection in Blender 3.4.1. I fail to make object P2 editable using Python (see image below). The operator that does the right job in the GUI is: bpy.ops.object.make_override_library. I used that on object P1, hence its override icon is no longer grayed out.
I prefer to use an lower level API instead of an operator but cannot find it. If the operator is the only option, I am not sure how to set the right context. The below code is not working correctly since it is creating some objects outside the collection.
with bpy.context.temp_override(active_object=bpy.data.objects["P2"]): bpy.ops.object.make_override_library()