Can't disable CharacterController script

(I know there are many forums about this but nothing I tried doesn’t work)
I’m trying to disbale character controller script in update by key pressing

void Update(){
   if(Input.GetKeyDown(KeyCode.E)){
      GetComponent<CharacterController>().enabled = false;
   }
}

First, I didn’t know why it is not working. I searched and I found that CharacterController is enabled by default.
I tried this

void Update(){
   GetComponent<CharacterController>().enabled = false;
}

It woked but I need to condition this by key pressing.

I also tried with a secondary script:
DisableControll.cs:

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

public class DisableController : MonoBehaviour {

    // Use this for initialization
    void Start () {
       
    }
   
    // Update is called once per frame
    void Update () {
            GetComponent<CharacterController>().enabled = false;
    }
}

and In main script:

GetComponent<DisableController>().enabled = true;

The DisableController doesn’t enable on key press

For your last code blob above, don’t you intend to GetComponent<CharacterController>(); ?

You are just (re-)enabling your DisableController with the code you listed…

Keep in mind Update() is run every frame. It’s not necessary to constantly be enabling or disabling the same object again and again.

Yes, but GetComponent().enabled = false; should be in Update because it is re enabling every time and I can’t controll thisby keypressing

Is your script on the same GameObject that the CharacterController is?

@kdgalla yes the script is attached to the FPSController