In this tutorial I will show you how can add a shape key to the branch using this source code:
# now set up shape key in Blender
mesh=obj_branch.data
sk_basis = obj_branch.shape_key_add(name='Basis',from_mix=False)
sk_basis.interpolation = 'KEY_LINEAR'
# must set relative to false here
obj_branch.data.shape_keys.use_relative = False
# create new shape key
sk = obj_branch.shape_key_add(name='Deform',from_mix=False)
sk.interpolation = 'KEY_LINEAR'
sk.slider_min = 0
sk.slider_max = 2
# ... and add it to the scene
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_1ZJZDBgiga4Ewp2gi-_-ieMfCPLQ1n4r9_kk8SMNBZcAZODnVVkBti6CddysYPU1m3j489EhYbF_61CRyeYkpVMSGYXIVxV_Xyo3jArG09PX6BERuW93ddpPa-f9FyzRqOkG5G-x6nmrv078ZG6jIMzy0XHtOBbgY-tQECJ-1AZpVw0tN_Qzeo2J/s1600/blender_3D_scripting_014_shape_key.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT5D0JqDrwUCNGHZLiatwFVrmhn03KtESq-oVnqu5xPi2BBCZzey2i2QjPa1nfu9vGcFO7T2F2-R-INBK9NjefcnpE24D-Mio5utq9C-S2xxyCaOUipDuBifmSO2FFs9_Fkw8JxZeIBwrWLKp3mVfs79xvr0xMey-K9G4kwck-jmpCWbsjZUfWO18z/s1600/blender_3D_scripting_014_shape_key_001.png)