How to check to see if a shapekey has drivers...

Hi, I’m trying to see whether if some of the shape keys have drivers assigned to them, but just can’t get it done… :frowning: My code is as follows:

import bpy
#get every shapekey and find out whether they’re muted or not…
shape_key =
kbloks = shape_key.key_blocks
for shape in kbloks:
acikMi = shape.mute
if shape.animation_data.drivers is not None:
if (acikMi == True):
print (

#Find and mute all active modifiers…
mods = ob.modifiers
for mod in mods:
mod.show_viewport = True

The line that contains “if shape.animation_data.drivers is not None:” is giving the following error:
‘ShapeKey’ Object has no attribute ‘animation_data’

What can I be doing wrong?




if shape.animation_data and shape.animation_data.drivers:

Thanx but that just doesn’t work at all… Why doesn’t this work, by Jove??? Very frustrating… :frowning: I’ve seen “.animation_data.drivers” in so many codes, why wouldn’t it work in this instance?

Have you tried accessing it via .context instead of .data?

.context? I dunno… Do you mean animation_context?