I want to access a variable in another object's script whose GameObject is stored in a variable in script 1.

So, I have this in script 1 attached to my player object.

		if(action){
			actionVar = Physics2D.Linecast (sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer("Solid")).collider.gameObject;
			Debug.Log ("actionVar is " + actionVar);
			action = false;
		}

On the npc object, I have script 2 attached.
public static bool actionRec;

void Update () {
		if (actionRec){
			textBox.SetActive (true);
			Debug.Log("action received");
		}
	}

Using the GameObject stored in actionVar (because it could change based on what object the linecast hits), how can I set the actionRec variable in script 2 to true from script 1?

Because it’s static you can access it directly from the Component after you retrieve a reference to it:

GameObject.Find("npcObjectName").GetComponent<Script2>().actionRec = true; 
// Where npcObjectName is the name of the GameObject your 2nd Script is on 
// and Script2 is it's name