# How to apply transformations to empties?

In Blender 2.81, I have a linked collection, and I want to apply a transformation over it. In the UI I just select the empty , so when I scale, translate or rotate the empty the liked data experiences the transformations too.

By the other hand, to do it with bpy, for objects is:

# object.type = 'MESH'
object.data.transform(transformMatrix)


But when I try to do it over an empty type:

# empty.type = 'EMPTY'
empty.data.transform(transformMatrix)


I get the error: 'NoneType' object has no attribute 'transform' because the empty's data property is None.

Is there a way to apply the transformations over empties? If there isn't how can I archive the same results?

I need to keep the collection linked because the source file changes quite often.

Thank you.

I found a solution:

You have to modify the empty's location, scale and rotation properties with the information contained in the Transformation Matrix. If you used vectors to build the Transformation Matrix, just apply them:

# For location add the vectors
empty.location = empty.location + traslationVect

# For scale assign the vector
empty.scale = scaleVector


If you have the transformation matrix you'll have to build the vectors based on the matrix's elements

PS: I didn't dive into rotations.