Help understanding data.bones and data.edit_bones

I’m trying to copy an armature piece by piece to separate it and I’m running into loads of problems between edit_bones and bones. I guess I really don’t understand the difference.

I would like to be able to create a new armature, loop through another armatures data.bones, and then just create a new bone in the new armature with the head/tail/roll same as the first.

I’ve also tried just using duplicate() and then trying to remove edit_bones, but I still have issues.
Does anyone know of a good resource to explain working with bones in the API, preferably without any bpy.ops as I like to avoid context issues.

Thanks in advance,

Thomas

Bones are difficult to say the least…

arm.edit_bones only exist if your armature is in edit mode, once you tab out then they are converted to arm.bones (which is also your default pose for pose bones).

To answer your question, it should work if you put your new armature into edit mode then create and copy the transforms of the arm.bones from the other armature.

@Uncle Entity - that helps quite a bit though I’m not sure why they are like that- anyway I found a combination of things that works so I’m able to copy bones. Thanks for the help.