← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #677405]: Organizing sikuli scripts into packages.

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
As long as SikuliX works with .sikuli folders, that contain the .py
script file and the images referenced in that script, there will not be
an easy solution for that.

Your workaround can be made simpler, since the import in a SikuliX script:
(see https://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-other-sikuli-scripts-reuse-code-and-images)
- looks for the script in the folder, the importing script folder is located
- auto-adds the imported .sikuli to the sys.path
- auto-adds the imported .sikuli folder to the imagepath

Be aware: 
since all images are looked-up in the imagepath only with their name (without path), you need a naming convention, that avoids name clashes between different scripts.

The only way to just use the plain Python module structure is to separate code and images. As a consequence you only can use the SikuliX IDE for capturing/storing your images and have to use another editor/IDE for your .py files (e.g. IntelliJ's PyCharm).
The one or more image-only .sikuli have to be added to the imagepath when needed.

I have on the list, to support such module structures in the SikuliX IDE.
But this does not help you currently ;-) and will surely take a few months to get ready.

Come back if you run into problems.
In such cases you might contact me directly and send your trials to my mail: sikulix---at---outlook---dot---com.

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