cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Create an add-in to run a python script

AhmedMetroEM
Level I

Hello,

 

Thanks @martindemel for the advice, so I will repost my questions.

I would like to create an add-in to run a python script, can you please help ? 

 

Thanks in advance

Ahmed

7 REPLIES 7
jthi
Super User


Re: Create an add-in to run a python script

What issues are you having? If you have JMP18 it won't really differ that much from running JSL (outside of the possible python package management).

-Jarmo
AhmedMetroEM
Level I


Re: Create an add-in to run a python script

Hello,

 

I'm using JMP18 and I'm probably doing this wrong. I'm creating a new add-on and, from the "Menu Items" tab. Then I select "add command", in action window there is only "Run JSL in this file" or "Run this JSL".

 

I have selected my python script but as expected it fails.

So how to have in action list Run PY in this file? is there another way?

 

AhmedMetroEM_0-1742893089670.png

 

Thanks,

Ahmed


Re: Create an add-in to run a python script

We are still working at improving the Python integration across JMP.  JMP's integration knows the directory that the JSL script is running from.  At present the code needs to be keyed off of a JSL script which can call the Python.  You can create JSL User Defined functions that are implemented in Python https://community.jmp.com/t5/JMPer-Cable/Creating-JSL-functions-implemented-in-Python/, Python Submit File("your_code.py"); and if the .py file is in the same directory as the JSL script, something like


Python Submit("\[
import your_code
results = your_code.function( )
]\");
Python Get( "results");

Should also work


Re: Create an add-in to run a python script

I agree with Jarmo, it might be that you first need to assure the package you are using is known to JMP.  Would be good to understand where you have issues. Under view->log you may get warnings or error messages which can help to identify the issue.

/****NeverStopLearning****/
AhmedMetroEM
Level I


Re: Create an add-in to run a python script

By using Run JSL, I logically have syntax issues because it is a python scrip. 

 

AhmedMetroEM_1-1742893415760.png

 

jthi
Super User


Re: Create an add-in to run a python script

Create JSL file which is able to run your Python code and test that it is working. Then use that JSL file in the add-in while making sure all files are in correct locations for it to run properly.

-Jarmo


Re: Create an add-in to run a python script

And here you can watch a session on python scripting within JMP with several ways from last years scripters club meeting: 
Running-Python-Code-within-JSL 

In addition Jarmo presented a poster at Discovery Summit Europe in Berlin this March: 
JMPyFacade-Bridging-JMP-and-Python-for-Seamless-Engaging 

/****NeverStopLearning****/