The Python Name option for Python Send() has a quoted string argument that contains a valid Python object name. The JMP object sent to Python becomes a Python object with the specified name.
The following example creates the jmp var name variable, assigns it to the Python name python_var_name, submits the print statement, and closes the connection.
Python Init();
jmp var name = 25;
Python Send( jmp var name, Python Name( "python_var_name" ) );
Python Submit( "print(python_var_name)" );
Python Term();
25.0
0
The following example creates a variable x in the Here namespace, a variable y in the global namespace, and a variable z that is not explicitly referenced to any namespace. The variable z defaults to Global unless Names Default To Here(1) is on. These variables are then passed to Python.
Here:x = 1;
::y = 2;
z = 3;
Python Init(); // initiate the Python connection
Python Send( Here:x );
/* send the Here variable to Python
Here:x creates the Python object Here_x */
Python Submit( "print(Here_x)" );
/* note that the JMP log labels the output with the original JMP variable reference Here:x. */
Python Send( ::y ); // ::y creates the Python object y
Python Submit( "print(y)" );
Python Send( Here:x, Python Name( "localx" ) );
// to use a different name for the Python object, use the Python Name() option
Python Submit( "print(localx)" );
/* the Python Name option to the Python Send() command creates the Python object named "localx", which corresponds to the JMP variable "Here:x". Again, the log shows the original corresponding JMP variable name. */
Python Send( z ); // z creates the Python object z
Python Submit( "print(z)" );
Python Term();
1.0
2.0
1.0
3.0
0.0