Animation is not playing (929432)

Hello fellow unity devs
I made a keypad system that works fine, however it is supposed to play an animation when code is correct but it doesn’t. I assigned the animator in inspector and even used a getcomponent() but the console still says that no animator is attached to the script while it tries to access it.
Any idea how to fix it? Thanks in advance

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewKeypadController : MonoBehaviour
{
    public Animator dooranim;
    private bool opened = false;

    [Header("Unlock code")]
    public int[] code;

    [Header("Current input code")]
    public int[] currentCode;

    int currentIndex = 0;

    [Header("Temp input controls")]
    public int input;
    public bool sendInput;

    private void Start()
    {
        ResetCurrentCode();
    }

    private void Update()
    {
        if (sendInput)
        {
            sendInput = false;
            AcceptInput(input);
        }
    }

    public void AcceptInput(int value)
    {
        currentCode[currentIndex] = value;

        currentIndex += 1;

        if (currentIndex >= code.Length)
        {
            for (int i = 0; i < code.Length; i++)
            {
                if (code[i] != currentCode[i])
                {
                    Fail();
                    return;
                }
            }
            Success();
        }
    }

    void Fail()
    {
        Debug.Log("incorrect code");
        ResetCurrentCode();
    }

    void Success()
    {
        Debug.Log("correct code");
        dooranim = GetComponent<Animator>();
        dooranim.SetBool("Opened", true);
        Debug.Log("well done:)");
        ResetCurrentCode();
    }


    void ResetCurrentCode()
    {
        currentIndex = 0;
        currentCode = new int[code.Length];
        for (int i = 0; i < currentCode.Length; i++)
        {
            currentCode[i] = -1;
        }
    }

    void Opendoor()
    {
        dooranim = GetComponent<Animator>();
        opened = !opened;
        dooranim.SetBool("Opened", !opened);
        Debug.Log("well done:)");
    }
}

well if you watch the animator, is the boolean changing, is the animation state changing?

No it isn’t. The animation doesn’t activate

ok. So as is the boolean changing on the animator? Have you confirmed your success code is running? These are basic steps to check

nope, the boolean is not changing and i can confirm that success code is runing

then you need to work out why the boolean isnt changing as nothing will work till that does