There were a few (minor) syntax errors in the sample code you sent for my example. It took me some time (am very new to jmp scripting) to fix it but it finally works like I want. Thanks again for the help. I am attaching the modified script below for others who may want it.
I have also realized that if the script is stored in the data table, I don't need to specify any (long) location path. Strangely I can't save a new script file to the data table. It has to be saved as as a separate jsl file. To work-around, I open an already existing script in my data table and modify it to input the new script.
There are multple methods to add a script to a data table. I think JMP could make it easier. As an FYI, this script shows just 3 methods to add a script.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myScript = Expr(Distribution( Column( :Height, :Weight ), By( :sex )) );
//---hard coded method below
//dt << New Script("New Script",Distribution( Column( :Height, :Weight ), By( :sex )) );
//--or use the syntax below that uses expression substitution then Eval() to run it
//Eval( Substitute(Expr( dt << New Script( "New Script", _xx ) ), Expr(_xx), NameExpr(myScript) ) );
//---or use Eval Expr() that does the substitution and Eval() that runs it
Eval( Eval Expr(dt << New Script("New Script", Expr(NameExpr( myScript) ) ) ) );