GetComponent(); returning null

So I’m trying to make an interface system for interactable items. Here’s the interface:

public interface IInteractable {

    // Can be interacted with
    public bool inter { get; set; }

    // Interact function
    public void Interact();
}

I took this and implemented it in the following test script, which I attached to a GameObject with proper colliders.

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

public class Test_NPC : MonoBehaviour, IInteractable {

    public bool inter { get; set; }

	public void Interact() {
		Debug.Log("Interact");
	}
}

Then I took a 2D Box collider and connected it to the player and attached the following script to it:

private void OnTriggerEnter2D(Collider2D other) { 
    var interactable = other.gameObject.GetComponent<IInteractable>();
    interactable.Interact();
}

It didn’t work, so I went in with a breakpoint, and- alas- interactable was returning null. other.gameObject was properly returning the NPC GameObject.

I’ve been struggling with this for the past few days, so I’ve been progressively simplifying the functions to no avail. Any help is greatly appreciated!

I don’t know how or why, but renaming the interactable variable in the box collider script to interable fixed everything. Then I took the Test_NPC script and modified it a bit:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class Test_NPC : MonoBehaviour, IInteractable {
 
   private bool _inter;

   public bool inter { get { return _inter; } set { _inter = value; } }

    public void Interact() {
        Debug.Log("Interact");
    }

    void Awake() {
        _inter = true;
    }

}

And the code worked perfectly. Hopefully this helps anyone stumbling across this in the future.