How do I call a method from another script without creating another instance of it?

I have an Inventory class and a Lootable class. The Inventory class is on my player, and the Lootable class will be on a variety of GameObjects. Ideally, on pressing Return, the Lootable class should call addItem() from the inventory class to add whatever GameObject Lootable is attached to to the array inv in the Inventory class. I’ve been stuck on this for almost a week, any ideas?

//Inventory3.cs
public class Inventory3 : MonoBehaviour{
	Item[] inv;
	int invSize = 20;
	
	public void addItem(Item item) {
		for (int i = 0; i < invSize; i++) {
			if (inv *== null) {*

_ inv = item;_
* break; *
* }*
* else {*
* Debug.Log (“Inventory is full”);*
* }*
* }*
* }*
}

public class Item : MonoBehaviour {

* public string name;*
* public string description;*
* public int id;*
* public int uses;*

* public Item(string name,string description,int id,int uses)*
* {*

* this.name = name;*
* this.description = description;*
* this.id = id;*
* this.uses = uses;*

* }*
}
//Lootable2.cs
public class Lootable2 : MonoBehaviour {

* GameObject player;*

* public string name;*
* public string description;*
* public int id;*
* public int uses;*

* void Start () {*
* player = GameObject.FindGameObjectWithTag(“Player”);*
* Item loot = new Item(name, description, 2, 0); *

* }*

* void Update () {*
* if (canLoot ()) {*
* Debug.Log (“You can Loot it!”);*
* if (Input.GetKeyDown (KeyCode.Return)) {*
_ //How do I call addItem(loot) here to put loot in the inv array? ****************************_
_
}_
_
}_
_
}*_

* public bool canLoot() {*
* Transform target = GameObject.FindWithTag(“Player”).transform;*

* if (Vector3.Distance (target.position, this.transform.position) < 9) {return true;}*
* else {return false;}*

* }*
}
Thanks! You people are the best!

Scripts accessing other script on other game objects is one of the most common questions on UA. GetComponent() is the solution. In order to make your code work, you have to declare Item at the class level. So on line 7, put:

private Item loot;

Then line 10 becomes:

loot = new Item(name, description, 2, 0);  

Then your line 19 becomes:

player.GetComponent<Inventory3>().addItem(loot);