Animation in Unity editor prevents rotation in script

What I’m trying to do

A 2D character with a bazooka attached. Character can move only left and right on the floor.
When pressing up or down the bazooka will rotate, kind of like the bazooka in “Worms”.

I animate the body parts of the game character when the he walks and would also like to animate the bazooka to move a little when the character is walking. I would prefer to do this visually with a key frame animation, not in code.

My problem

The code for rotating the bazooka works perfectly until I created a key frame animation involving the same bazooka.
To confirm I then removed the GameObject from the key frame animation and the rotation starts working again.

Just to be clear, the animation is not running and is not suppose to be running the same time as the rotation is occurring.

Basically it seems I have to choose between the keyframe animation of the bazooka or being able to rotate the bazooka on key up or down at all.

Is there a technique to do this “the right way”, without having to make this choice?

Code used for rotation

Not sure its needed but the code below runs in FixedUpdate to rotate the weapon around it’s own axis when pressing up or down.

if (Input.GetKey ("up")) {
if (Input.GetKey ("down")) {

Create a prefab with this kind of structure:

   L AnimObject

Make your script control the parent object, while the Animation control the AnimObject