I have a rig in Blender, and I want to write a script that selects any one rig control. But I am unable to select the the control. What I am basically doing is copying the python instructions on the top panel and repeat them in the script editor.

Here is the code I have so far :

import bpy

bpy.context.space_data.context = 'DATA'
bpy.context.object.active_index = 0

First 2 lines work fine, then I am going to data tab and selecting a bone group. Here I get the error : SpaceTextEditor has no attribute 'context'

I'm sure this is some silly error but I'm an absolute beginner so any help is appreciated :)


  • $\begingroup$ Do you want to select a bone in pose mode? $\endgroup$ – Leander Jan 15 '17 at 11:44
  • $\begingroup$ bpy.context.space_data.context = 'DATA' is setting the properties window to display data panels, eg mesh for mesh, bones for armature object. Could prob just ditch it. Then you'll get "context.object" has no "active_index" prop, do you mean "active_shape_key_index" perhaps. $\endgroup$ – batFINGER Jan 15 '17 at 11:45
  • $\begingroup$ @ Leander - yes, I am trying to select the bone, i guess. $\endgroup$ – varun vishnani Jan 15 '17 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.