keep Java object alive between two script

W

Wilson Chew

Hi,

This is more of a Jython question, I guess.
Say I have a Java program MyJavaClass which will be called from two Jython
scripts: script_1.py and script_2.py:
----------------------------------------------
#script_1.py
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();
interp.execfile("script_1.py");
// will I be able to keep "myObj" alive after the execution of
script_1.py ?
// will I be able to somehow get the object "myObj" that was created
in script_1.py and use it?
interp.execfile("script_2.py");
}
}
================================
My questions are written in the program above as comments.

Thanks everyone in advance.


Wilson Chew
Summer Intern,
Qualcomm. Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top