Set active shape key using Python I would like to set active shape key using Python. I know that I can use following code for this purpose:

bpy.context.active_object.active_shape_key_index = some_index


but, when I have several shape keys, then I don't know how to get this index from given shape key:

sh_key = bpy.context.active_object.data.shape_keys.key_blocks["shape_key_name"]


There is no attribute called index in object sh_key. I tried to use bpy.context.active_object.active_shape_key, but this attribute is read only. Thanks for your help.
Hi here is some quick code from the python console,

I have an active object with a number of shapekeys, "Key 1" being one, I find the index using find(...) then set the active_shape_key_index to this number.  

find(...) will return -1 if a key of that name is not found.

&gt;&gt;&gt; index = C.object.data.shape_keys.key_blocks.find('Key 1')
&gt;&gt;&gt; index
1

&gt;&gt;&gt; C.object.active_shape_key_index = index
&gt;&gt;&gt;