"The name 'openDoor/closeDoor' does not exist in the current context" calling void from another script

I’m trying to use triggers to open and close a door, and I’m using two different scripts to do so.
Here is my code for the one calling the void:

 void OnCollisionEnter(Collision col)
    {
        if(col.gameObject.name == "Player")
        {
            if (IsOpen == false)
            {
                openDoor();
                IsOpen = true;
            }
            if (IsOpen == true)
            {
                closeDoor();
                IsOpen = false;
            }
        }
    }

and here is my code receiving the “call” (haven’t put anything in them yet)

    public void openDoor()
    {

    }


    public void closeDoor()
    {

    }

But I am getting an error where it says “The name ‘open/closeDoor’ does not exist in the current context”. I have looked it up and nothing has solved anything.

You need to reference the other script, openDoor doesn’t exist in that script, you get the reference from the collision event. Use the col parameter, col.gameObject.GetComponent().openDoor(); just be careful about where, how often and when you use GetComponent, it can add lag. You can also use a global reference to the player/script you want or access or static methods to avoid using GetComponent.