how to access a method declared inside a script attached to child of another gameobject?

i want to invoke a method which is inside a script which is attached to the child of another gameobject. how can i invoke it from a script which is not on the same gameobject?

i guess i figured it out on my own :slight_smile:
first i created an instance of the target script like this:

public targetscript variablename;

then in the hierarchy i dragged the gameobject which had my targetscript attached to it into the empty field of the current script.

and then i simply did variablename.methodname();