I am trying to add an object using from_pydata but am unable to deselect the added item - which is currently outlined in red and then select it so it is outlined in orange - and enter Edit mode.
`mycode
import bpy, bmesh
me = bpy.data.meshes.new("Vert" + "Mesh")
ob = bpy.data.objects.new("Vert", me)
me.from_pydata([(1, 2, 5),(0,-1,0),(2,-2,0)],[],[[0,1,2]])
bpy.data.collections['Collection'].objects.link(ob)
bpy.data.objects["Vert"].select_set(True)
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
bpy.context.active_object.select_set(False) # attempt 1
bpy.data.objects["Vert"].select_set(False) # attempt 2
bpy.ops.object.select_all(action='DESELECT') # attempt 3
bpy.data.objects["Vert"].select_set(True)
bpy.ops.object.mode_set( mode = 'EDIT' ) # Toggle edit mode
bpy.ops.mesh.select_mode( type = 'FACE' ) # Change to face selection
bpy.ops.mesh.select_all( action = 'SELECT' )`
The newly added object is circled in red as opposed to the usual orange. A simple click on anything other than the object "Vert" and select again will make the object orange, as required, but I seem unable to do this via code. I have tried adding other objects, or selecting other objects in the scene but with no luck.