Cannot apply indexing with [] to an expression of type 'Animator'

Hi, so I’m trying to set up an animation that only loops once before transitioning to another animation, but like the tutorials I read, they use indexing. It doesn’t seem like it should be an issue, but I keep getting the error stated via line 3. Any tips on how to remedy this? Thank you!

if (isSpawned && xLastMove.x > 0)
        {
            anim["SpawnLeft"].wrapMode = WrapMode.Once;
            anim.Play("SpawnLeft");
        }

Ah, made a mistake. I set anim to the Animator GetComponent when Wrap Mode uses the Animation GetComponent. Thought I’d share this!