Pass C# script as parameter to function

Okay I have two or more scripts in separate objects that do the same.
(Complex checking inventory system checking if the clicked Button has item in it)

What I need to do is make one static function containing that huge code.

And now my problem is:

void myFunction(script scriptName, int i)
{
     if(script.inventorySlot *== texture_apple) //texture apple is assigned texture*

{
just do something;
}

}
So you see my problem is that multiple scripts needs to pass themselves or other scripts into myFunction() as script parameter.
How to do that?
This doesn`t work as well

void myFunction(gameObject Object, int i)
{
if (Object.GetComponent() != null)
target = Object.GetComponent();
if (Object.GetComponent() != null)
target = Object.GetComponent();
if(target.inventorySlot == texture_apple) //texture apple is assigned texture
{
just do something;
}

}

The type should be Component or MonoBehaviour.

Edit: Based on your further clarification it looks like you need to use inheritance or implement an interface. Check out the tutorials on this in the learn section. Also read up a bit on OOP. Will certainly help here.