How to use onMouseHover in an object in other script?

I have the GameObject 1 and 2, I want the script to be in GameObject 1, but the onMouseHover script in GameObject 1 must be about GameObject 2.

I want something like that (I know it’s wrong):

public GameObject "GameObject2"

void onMouseHover("GameObject2")
     do something

its not OnMouseHover but OnMouseOver;

void OnMouseOver()
     print (;
  //Here you can get the reference using gameObject.GetComponent<Scriptname>();