How to access the value of a bool in another script c#?

script 1:

public bool Enabled;

if (Input.GetKeyUp(KeyCode.Escape))
{

Enabled = !Enabled;

}

script 2:

if (!Enabled)
{

debug.log (“ESC has been pressed”);

}

My problem is that the second script doesn’t know what Enabled is. This is a very simplified version of my code but if this can be answered ill be able to implement it in my actual code. So basically what i want to do is have two different scrips but when Enabled changes to true or false i want it to also change the other script. Please answer the question if possible without the solution being put it all in one script.

First you have to access script1 in script2

script2 
---------------------

Script1 script1Object;

void Start()
{
script1Object = GetComponent<Script1>();
}

void Example()
{
if(!script1Object.Enabled) {
debug.log ("ESC has been pressed");
}
}

There are several ways to do it. If script 1 will only ever exist on one object, make Enabled static. Then from script 2, you can use “Script1.Enabled”.

Otherwise, you would need a reference to script 1.
I.e. Script1 obj = GetScript1SomeHow();
Then use obj.Enabled