can anyone please help me

I am creating a user interface but i wish to open and close the serial port. I want to declare these two methods in a seperate file and then call them just before my interface is opened and then close it just after the interface has been closed down. How do i go about defining a method and then calling it in a different file???

any help would be grateful