my main.sikuli skips over import

Asked by Dalton Shehan

I have a file directory that contains all my sikuli files. It has a main.sikuli, uninstallTest.sikuli, and install.sikuli. At the beginning of uninstall and install test look like this
from sikuli import *
uninstall some stuff/install some stuff
delete some data directories/setup some stuff in newly installed software

 and in the main it has something like this:

popup("Lets begin testing")
from uninstallTest import*
popup("uninstall complete")
from installTest import*
popup("install complete")

The problem I am seeing is that most the time it skips right over the uninstallTest import. So basically i'll get the first popup then the second popup then it will run the installTest import. Sometime it will run the uninstallTest which is why I dont see what I am doing wrong. As I understand long as they share the same directory thats the way to import them. Any help would be appreciated?

I am using Sikulix-1.Orc3(r905) on a windows xp

Question information

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

Your imported modules seem to contain normal script code. This is executed only once, when the module is imported the first time after starting the IDE (hence the first run). So a second run will not execute the stuff again.

So you either have to run your script from command line (so it runs only once by definition) or use the reload feature:

import uninstall
reload(uninstall)
from uninstall import *

BTW:
from uninstall import *
is only necessary, if you use any names from the subs in your main.

see: http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images right at the beginning.

Revision history for this message
Dalton Shehan (j-dalton) said :
#2

Thank you so much that works!