How we can import Python modules in Jython?

PythonServer Side ProgrammingProgrammingJython

You can use pure python modules from jython. You can't use modules that are implemented in C. To use modules from your pip installs, you need to add the sys.path of python to that of Jython as Jython does not automatically pick up the PYTHONPATH information

Jython 2.5 introduced the JYTHONPATH environmental variable as Jython-equivalent of PYTHONPATH, so setting both to the same value should do the trick for most use cases (unless you're working in a setup with incompatible Python an Jython versions).

Now you can import python modules installed locally directly using 'import' in Jython.

Updated on 30-Jul-2019 22:30:20