I am in blender 2_92…
I run a script that takes a reference object (ReferenceThickLine), and creates copies of it (LineZinner_m_n_o, where the last created is LineZinner_04_1_3, meaning that it is left selected after being created). I apply a material to each copy.
The last lines of the code are:
bpy.ops.object.select_all(action='DESELECT') bpy.data.objects["ReferenceThickLine"].select_set(False) bpy.data.objects["ReferenceThickLine"].select_set(True)
The idea being to deselect LineZinner_04_1_3 and select ReferenceThickLine and that one only.
As you can see on picture below, left side, the result is that somehow, LineZinner_04_1_3 is still “kinda” selected, at least its material is. The red arrows point to where the problem is.
When I click on ReferenceThickLine with the mouse, then it ends up being the only one that is selected, see picture, right side.
The question is: what do I have to do in the script to obtain picture 2 as a result and not picture 1?
P.S.: I tried bpy.ops.outliner.item_activate(extend=False, deselect_all=True), and I get to know that the context is incorrect, which is above my pay grade, meaning that if somebody could explain that one to me too, I would be delighted…