JMP will just 'find it' if it is in the same directory as the launching .jsl or .py script. There is an issue in JMP 18.0 if the launching script is .jsl, it doesn't find the .py import.
It should work fine from both .jsl or .py scripts in 18.1+
The other way is to create a pyproject.toml file, put the script into a directory of the same name as the file and an appropriate pyproject.toml file. This makes it an installable package which jpip can then install into the JMP site-packages/ location. See Python.org's docs or many other tutorials on creating installable Python packages. Such as: https://til.simonwillison.net/python/pyproject
The code below is quick and dirty and probably doesn't follow python best practices. I think there is usually an __init__.py file and __main__.py or main.py instead of the file matching the package directory... But the toml file lets you specify lots if things including dependancies as show below.
dt2pandas/
dt2pandas.py
pyproject.toml
pyproject.toml
[project]
name = "dt2pandas"
description = "jmp.DataTable to pandas.DataFrame example"
authors = [
{ name = "Paul R. Nelson", email = "paul.nelson@jmp.com" }
]
version = "0.1"
dependencies = [ "pandas" ]
At which point you can do a
jmputils.jpip('install', '-e _my_path_to/dt2pandas')