Typically you would acquire a reference to the game object or component in question, and then access the variable (directly or indirectly) via that reference.
You can find some info on accessing other game objects in the scene here.
Then you’d first need to acquire a reference to the object containing the other script (see the link included in my first reply for examples of how this can be done).