How can i select bones in armature edit mode and delete them by script? maybe this will do the job…
You don’t need to select it:
import bpy
ob = bpy.context.object
assert ob.type == 'ARMATURE'
arma = ob.data
bpy.ops.object.mode_set(mode='EDIT') # ensure edit mode
bone = arma.edit_bones['Bone']
arma.edit_bones.remove(bone)
# Redraw 3D View manually
# (if already in editmode, deleted bone will still display until next redraw)
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
area.tag_redraw()