Can't start Coroutine since object is "Inactive"

Here’s the guilty coroutine in EnemyAnim.cs

 IEnumerator LeftRightMovement()
    {
        while (true)
        {
            for (int i = 0; i < 100; i++)
            {
                Debug.Log("executing");
                transform.position = new Vector2(transform.position.x + y, transform.position.y);
                yield return new WaitForSeconds(0.02f);
            }
            new WaitForSeconds(3f);
            AssignMoveLeftRight(transform.position);  //stops current coroutine without yield break and start a new instance of this one
        }
    }

I’m trying to start it from another script called EnemySpawner.cs this way :

public class EnemySpawner : MonoBehaviour {

    public Vector3 ThisPos;
    public GameObject Enemy;
    EnemyAnim enemyAnim;


	void Start () {   
        ThisPos = transform.position;
        enemyAnim = Enemy.GetComponent<EnemyAnim>();
        Enemy.transform.position = ThisPos;
        Instantiate(Enemy);
	}
	
	void Update ()  {
        if (Input.GetKeyDown(KeyCode.R))
        { Instantiate(Enemy); enemyAnim.AssignMoveLeftRight(transform.position); } //Enemy.GetComponent<EnemyAnim>().AssignMoveLeftRight(transform.position); }
	        }

Inside the AssignMoveLeftRight(vector3 vector) method there’s the line that asks to start the coroutine, the method resides in EnemyAnim.cs

Log error sais “Coroutine couldn’t be started because the the game object ‘Attack’ is inactive!”

This has already been answered here: