keep Java object alive between two script

Wilson Chew wchew at
Tue Jul 20 21:04:20 CEST 2004


This is more of a Jython question, I guess.
Say I have a Java program MyJavaClass which will be called from two Jython
scripts: and
from MyJavaClass import *

myObj = MyJavaClass()
myObj.startJavaFunc()    #startJavaFunc() is a method in MyJavaClass()


Then I have a Manager class that will invoke these scripts, as shown below:
package TestSuiteManager;
import org.python.util.PythonInterpreter;
import org.python.core.*;

public class TestSuiteManager {

    public static void main(String[] args)
        PythonInterpreter interp = new PythonInterpreter();
        // will I be able to keep "myObj" alive after the execution of ?
       //  will I be able to somehow get the object "myObj" that was created
in and use it?
My questions are written in the program above as comments.

Thanks everyone in advance.

Wilson Chew
Summer Intern,
Qualcomm. Inc.

More information about the Python-list mailing list