When Player Collide with Cube, Cube changes to Rigidbody 2D

Hey everyone, I’m just creating a platform game where you are a cube and you have to pass the level, there are many Enemies on the level and I would like that if Player touches Enemy this becomes physical and Rigidbody2D (Dynamic) will turn on.

Here is my script that is in Player but it doesn’t work, can anyone know how to fix it?

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

private Rigidbody2D rb;
public class EnableComponents : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        Rigidbody2D.isDynamic = false;
    }

    // Update is called once per frame
    void Update()
    {
        void OnCollisionEnter2D(Collision2D col)
        {
            if (col.gameObject.tag == "Enemy")
            {
                Rigidbody2D.isDynamic = true;
            }
        }
    }
}

First you should declare the variable “private Rigidbody2D rb;” in the “EnableComponents : MonoBehaviour”- class. Second you can’t write “void OnCollisionEnter2D(Collision2D col) { }” in a “void Update ()”.
Try this out:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class EnableComponents : MonoBehaviour
 {
     private Rigidbody2D rb;

     // Start is called before the first frame update
     void Start()
     {
         rb = GetComponent<Rigidbody2D>();
         Rigidbody2D.isDynamic = false;
     }
 
     // Update is called once per frame
     void Update()
     {
        
     }

     void OnCollisionEnter2D(Collision2D col)
     {
         if (col.gameObject.tag == "Enemy")
         {
             Rigidbody2D.isDynamic = true;
         }
     }
 }