Commands and procedures are executed in the same way. The following examples illustrate this point.
proc float myTime(string $dummyFlag, float $time) {return $time;}
currentTime -e 1;
myTime -e 1;
currentTime "-e" "1";
myTime "-e" "1";
currentTime("-e", 1);
myTime("-e", 1);
To execute a command or procedure and get the return value you could use the eval, ``, or ( ) syntax as the following examples illustrate.
string $transforms[];
$transforms = eval("ls -type transform");
$transforms = `ls -type transform`;
$transforms = ls("-type", "transform");
There are important things to remember when using each of these types of syntax. Below are the key differences between them. Read them so you know which one to use.
For example, if you try to execute a script that first loads a plug-in and then immediately executes it, the script will fail when the plug-in command is executed. This is because Maya initially evaluates the script to check for commands that it does not know. However, if the plug-in command is executed using the eval syntax then the script will not fail.