Simple animation not playing using animation.Play();

I have two of the following, one for the left and one for the right. This moves the players position. There is a problem with the animation not playing though. Ive used javascript for it in the past and assign

var Animator : GameObject;

Which i dont think you do for c#?

Any help is appreciated, thanks.

using System.Collections;

public class right_Movement : MonoBehaviour {
	
	public Texture2D button1; // Inital texture for the button
	public Texture2D button2; // Once pressed texture
	public GameObject Player; // Declares the player from a gameobject 
	public int speed;
	public Animator anim;

	void Start () 
	{
		anim = gameObject.GetComponent<Animator>();
		guiTexture.texture = button1; // gui texture is made into button1
	}
	

	void Update () // If the screen is touched 
	{
		foreach (Touch touch in Input.touches)
		{
			if (guiTexture.HitTest(touch.position) && touch.phase != TouchPhase.Ended) // If the gui texture is touched then
			{

				guiTexture.texture = button2; // The button changes to button2

				anim.SetBool ("run_right", true);
			
				Player.transform.Translate(Vector3.right * speed * Time.smoothDeltaTime); // Player slowly moves to the right



				
				
			}
			else if (guiTexture.HitTest(touch.position) && touch.phase == TouchPhase.Ended) // until the player stops touching the screen
			{
				guiTexture.texture = button1; // gui texture reverts back to the original 

				anim.SetBool ("run_right", true);

			}
		}
	}
}

Try Player.animation.Play(“left_run”);

In the Animation component, set the Animations value (collapsed in the picture you show) to 1. It will then show a slot for adding an animation, similar to the one called “Animation” which now says “None”. Drag from your project resources the “left_run” animation to the slot, and try again.

Turns out that the gameobject was assigned to the player but i called gameobject instead of player. Silly