Animations with scale curve resetting scale of Transform

I have noticed that when an animation that has a scale curve is present in an object’s animator, its scale gets reset to what it is in the inspector every single frame. This happens even if the animation is not played, it only has to be present in a state of the animator. I don’t know why this happens and whether it is supposed to, but it is stopping me from changing the scale of the object using its script, since the scale is reset every frame doing so has no effect. What am I missing here? Surely it is possible to change the scale of an object programmatically that has animations that change it’s scale.

In the animator of your object, see if “Write Defaults” is checked.
Uncheck that. probably in the Idle state.