in general you'd run an external proc ( .p ) persistently.
meaning the proc is runned, but stays in-memory "persistently", instead
of terminating when it gets to the end of the proc.
including all it's vars, internal proc, functions etc. until you explicitly
delete the proc.
you can then run internal proc and functions in the persistent proc
using the proc's object handle.
there are many variations, like, super proc, prototypes, dynamic-function
etc. but the basic approach is the same.
invoking a proc or function locally in the same session or in a remote
session on an appserver is very similar.
though there are very diff best practices.
i recommend, that you start using the docs, especially if you
have specific questions.
my first instinct when i have a question is to open the docs or check
the kb, there are other great, free resources @psdn.com.
i hope it doesn't come off the wrong way, it's just that it's the best way,
or approach to learning.
"programming handbook" doc, "advanced use of procedures" chapter,
there are plenty of examples. hth