Unable to deselect newly added object with Python (Change red selection to orange) - Blender 2.8
The Orange you mention is Active state of object,
as other posts described, it is separated from selected object.
The Red ones is selected object. Newly created object in script will be &quot;selected&quot; but not active by default.

If you want to set it as active object:
bpy.context.view_layer.objects.active = some_obj - 2.80 API
For further information: Set active object with python - Blender Stack Exchange