Import another .sikuli module file to this .sikuli file

Asked by xiaoyan

like this.
Follow TestA.sikuli content:
a="abc"
def hey():
    print(a)

Follow TestB.sikuli content:
import testA
testA.hey()

run the TestB script, the result is successfu.
But if you change the TestA's content, like this,
a="efg", then run the TestB, the result also is "abc".

Because the sikuli will invoke the jython.jar pythoninterpreter execfile, so the second time, it will not generate a new $py.class file.

Dear, how to resolve this issue?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
xiaoyan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

either run your script from command line (you might still have the IDE in parallel open for editing) or

use:
import testA
reload(testA)

but be aware, that code in the sub on indent level 0 is executed twice at first import and reload (in your case a="abc").

Revision history for this message
xiaoyan (xiexiaoyan-119) said :
#2

RaiMan.Thank you very much. It is greatful.