To be sure, declare the var as a global in your main script. Don't leave things to chance by not declaring them.

Works great, actually.. I declare $PROCNAME as a global in my main script. Subscripts immediately set $PROCNAME="myname" and load some UDFs. Each UDF in a subscript begins with "MyName", so I can make calls (via Exec) like this:
 Code:
$Fn = $MyName + '_Init()'
Exec($Fn)

This initializes the module, which often calls other functions from the sub-script. I have an app that dynamically loads and defines specific capabilities in this way - add a file, you add functionality. Delete a file, remove functionality.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D