← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #303256]: How to use relative path in Sikuli to load another python script

 

Question #303256 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/303256

    Status: Open => Answered

RaiMan proposed the following answer:
SikuliX has a special import support for scripts (script folders) and
with version 1.1.1 even reload() is no longer needed.

The rules and possibilities:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-other-sikuli-scripts-reuse-code-and-images

Hence in your case with this setup:

                |-Main_Test.sikuli
                 | |-Main_Test.py
                |-set_config.sikuli
                 | |-set_config.py
                |-TestCase1.sikuli
                 | |-TestCase1.py
                |............

you do not need any sys.path handling, since all .sikuli in the same folder are automatically found by import.
... and if you just copy the stuff unchanged to anywhere, it will run out of the box.

Another option you might use for running a series of scripts from another one:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.