Script doesn't behave well when imported

Asked by Miguel E Torrealba

Hi, I am totally new to programming and sikuli.

I have done 2 scripts which work perfectly when running them independently from the Sikuli GUI or from a batch.

I have tried running both scripts from a batch file but it only runs the first one.

Then I decided to use the importing method in sikuli and made a main script that imports the other 2.

The importing goes well and starts the fist script, but here comes the problem, the script does't behave well, it doesn't find objects well or it doesn't click in the right places.

I found that when I remove the line: "from sikuli import *" and run the script independently in the sikuli GUI it works fine.

So the line "from sikuli import *" at the beginning is creating trouble.

Any recommendations?

Thanks.

Question information

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

In case you select the way to import other Sikuli scripts, your imported script must contain "from sikuli import *".
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-other-sikuli-scripts-reuse-code-and-images

In case you select the way to use runScript feature, see the following page.
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

Revision history for this message
Miguel E Torrealba (mike77pzo) said :
#2

Thanks masuo, that solved my question.