I can't understand some type definitions like

bones Type: ArmatureBones bpy_prop_collection of Bone, (readonly)

link: https://docs.blender.org/api/current/bpy.types.Armature.html#bpy.types.Armature.bones

What is this type? Type should be simply one word. Why this one?

ArmatureBones bpy_prop_collection of Bone

We suppose to get data based on the reference section like this one, but I can't find bpy.context.armature.

Can you shed a light one this?


Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
AttributeError: 'Context' object has no attribute 'armature'

enter image description here

Here are some variables also shown in manual, but I can't get them from my context. I find difficult to understand this manual. I want to show you, but (I can't pose another picture. " You need at least 10 reputation to post more than 2 links?!" I just want to add another picture). Anyway it is listed in the manual as:


Type: bpy.types.Bone


Type: bpy.types.EditBone


Type: bpy.types.PoseBone

It comes out that I can't find C.bone or C.pose_bone in console. Then why are they listed in this manual?


1 Answer 1


Don't worry, learning to read an API is a skillset unto itself, and a non-trivial endeavor at that, so it's okay for it to feel daunting. Unfortunately, it's usually necessary.

To answer your first question, ArmatureBones is a member of armature. It is a container, but it's not a built in Python container like list or tuple. It's a Blender container of type bpy_prop_collection, and this instance of that type of container contains Bones.

This would be roughly equivalent to saying "Encyclopedia is list of Books."

To answer your second question, there are a number of different types of context. Without knowing which one you're referencing it's hard to guess. However, there is a screen context, and it makes sense that a screen doesn't have an armature. So if you're referencing one of those other contexts, it'd make sense for it to has no attribute 'armature'.

Furthermore, the context that does have an armature is the buttons context, which means it's probably not the armature you're looking for. I suspect that you're actually after bpy.data.objects["name_of_your_rig"].data as referenced in this answer over here.

I hope that helps!

  • $\begingroup$ Thank you. I feel much better from your explanation. Another question is that if there are a number of contexts, what doesn the bpy.context in python console return. How can we know if the context from "bpy.context" a button one or a scene one? For example, I called bpy.context with one bone selected in pose mode. What context will be returened in this scenario? $\endgroup$ Commented Aug 7, 2017 at 16:45
  • $\begingroup$ I think bones is a member of Armature instead of ArmatureBones. Because, I tried to use C.object.data.ArmatureBones which can't be accessed but C.object.data.bones can be found. So I assume bones is a member whose type is bpy_prop_collection of Bones. Then what is ArmatureBones here? $\endgroup$ Commented Aug 7, 2017 at 17:09
  • $\begingroup$ You're right, Bone is a member of Armature. There's a container that's also a member of Armature, and it contains the Bones that belong to a particular instance of Armature. The container is a bpy_prop_collection called "ArmatureBones." $\endgroup$
    – Matt
    Commented Aug 7, 2017 at 17:25
  • $\begingroup$ I'll see if I can write something up about context after lunch... $\endgroup$
    – Matt
    Commented Aug 7, 2017 at 17:25
  • $\begingroup$ The data type context members are often only available to the PROPERTIES space. eg select an armature object, go to the data panel (with the little armature icon) rt click on "view source" over the armature name .. and low and behold arm = context.armature. You'll find there is a context.mesh context.speaker etc etc for other data types, but only when coding in this (properties) space. $\endgroup$
    – batFINGER
    Commented Aug 7, 2017 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .