creating a script function

so this is really noobish but I cant quite figure it out.

assuming I have script A and script B attached to an object and i want to be able to type in script A

GetComponent<scriptB>.myfunction();

how do I go about writing script b, either to make a variable or function you can access with the ‘.’ operator. I thought for example this is script B.

Public int mynumber;
Public void myfunction(){
....do something
}

would allow me to do the scriptB.mynumber and scriptb.myfunction because the class is scriptB so functions declared in there should be accessable.

im really just trying to take a large script that i’ve wrote and divide it up into parts so its more managable and I can add or remove parts of the script easily.

That’s it, just add ():

GetComponent().myfunction();