← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #237430]: How do I import a simple python module in my Sikuli script ?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
What version?

--- Tried putting one .py file ... in the Jython libs 
what folder do you mean by "Jython libs"

--- from which path does the this.py gets imported in the Sikuli script
together with the support of being able to import .sikuli scripts (adding this to the iamge path too), the parent folder of the running script and the script folder itself are added to sys.path at the first import of a .sikuli.
hence the easiest way to import other Python snippets is to pack them in a .sikuli and have them in the same folder as the running script.
In all other cases you have to add appropriate entries in sys.path before.

Another general option to just execute some stored Python lines of code is to use
execfile("path-to-a-file-containing-python-code")
The code in the file is run in the context of the current script.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.