OnCollisionEnter2D isn't working

I have two objects, both of them have rigidbody2d set to dynamic and istrigger is off. Both the objects when collided on screen register the collision and do not pass through each other. But the code under the
void OnCollisionEnter2D(Collision2D col) isn’t working at all. The spelling is correct. Please help. I’m posting the whole code from the script. Thank you!

    public TimeManager timeManager;
    public Animator anim;
    public Animator anim1;
    
    public static Plane instance;
   
     void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
    }
 
    void Start () {
   
    }
	
	void Update () {

        if (Input.GetButton("Fire1"))
            {

            SlowTime();
  
        }
 
    }

   void SlowTime()
    {
        timeManager.SlowMotion();

    }


    void OnCollisionEnter2D(Collision2D col)
    {

        if (col.gameObject.tag == "Bullet")
        {
            anim.SetTrigger("Hurt");
            anim1.SetTrigger("KnockBack");
            Debug.Log("Hello");

        }

    }


}

I just figured it out. It was very stupid of me. The object with the code and the object with the box collider were different but under the same parent. I added the box collider to the object with the script and it’s working great now. Thank you so much for your time!