My Jython script is calling some code that I'm writing in Java (because I am more comfortable with Java multithreading). Now it turns out that I need to call one of the Jython methods from Java (otherwise I'd have to re-write it in Java).
It's easy to drive Java from Jython, and it's also straightforward to set things up such that Java is the master and Jython is the slave, but it's not as obvious what's the best way to set it up so that they could call each other.
The official documentation contains a very long article about all this: Chapter 10: Jython and Java Integration, which makes the task seem hard at first glance: one-to-one object factories, loosely-coupled factories, and a lot of code to make it work.
There are other sources I found which also go into a lot of detail, but neither offer any simple solutions:
Since there is a Jython interpreter already running, there should be a simple way to call a method in it, without having to instantiate a new interpreter (as in the last link above, and as you would need to do if Java was driving Jython). Is there actually such a way?