Using import to run multiple scripts one after the other --- not recommended - use runscript instead

Asked by Lara

*************** the recommended feature:

http://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

In contrast to import, this feature has a defined way to hand over parameters and to check the return code.

import as a Python feature is not intended to run the code contained in the imported module, but to provide elements to be reused in other scripts according to the design principle DRY (Don't repeat yourself). So usually a module contains classes, methods and functions and simply does nothing when being imported. The elements defined in the module can then be used in the importing code.

--------------------------------------------------------------------------------

I'm currently doing test script using Sikuli in Mac Os. I'm wondering if I can run multiple scripts sequentially.
I have try to use import, but whenever I try to run my script, I encountered below error:

-> [error] SyntaxError("mismatched input ' -' expecting NEWLINE".)

I'm hoping that you could help me with this. 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
Revision history for this message
Lara (jhela) said :
#2

Thank you I was able to run my scripts now .

The name of my script contains hyphen that's why I've encountered "SyntaxError ( "mismatched input '-' expecting NEWLINE", )".
I just changed the hyphen (-) to underscore(_).

https://answers.launchpad.net/sikuli/+question/243869 this also help me to solve my problem.

Thanks a lot :)

Revision history for this message
Lara (jhela) said :
#3

Thanks masuo, that solved my question.