Shape key value copy to another object script

Hi there,

I have 2 object
First object name is Body
Second object name ia Cloth

And the Body object have shape key with name Size
And the Cloth object have shape key with same name Size

I need script for “ when adjust size shape key value in Body, then will change same value for Cloth object


Any reason for not just using drivers?

To be more clear for what i need exactly,
I working on script addon
And the first thing need append Body object
And then adjust the Size value and then will append the Cloth object

And when append cloth object I need take size with same value in body object size shape key

Okay then
Say we have objects ‘source’ and ‘target’, with shapekeys named ‘SIZE’.
Once you set source value by whatever means (in this case I’m just copying from source object), you can use it to write into Target like so:

src = D.objects['source']
trg = D.objects['target']

size_value =['SIZE'].value['SIZE'].value = size_value

…at least it seems to work

Really I tried to put it in my script but it’s not work.
Please tell me where the correct location can I put it in my script.

Uhhh, well, that depends on your script.
This code is only meant to show how to access shape key values of given objects.
Naturally, being a simplified example, it should be re-written to fit your case (the way you add your objects and set their data, how/when you execute the script, etc).

I should think it should be somewhere after you add the first object and set its shapekey value and before adding the second.

Really thank you, It’s working now…

Best regards,


D.objects[‘target’].data.shape_keys.key_blocks[‘SIZE’].value = D.objects[‘source’].data.shape_keys.key_blocks[‘SIZE’].value

(all in one line of course)


True, but it’s written like that for readability: “this is how you read a value” and “this is how you write a value” sort of way, for educational purposes :slight_smile: Dividing info into relatively simple logical chunks tends to produce better results when explaining anything


Yeah… I’m a retired software engineer, so I couldn’t help myself :rofl: Sorry.

1 Like