sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #05540
Re: [Question #171825]: Importing Sikuli Script
Question #171825 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/171825
RaiMan proposed the following answer:
@Sean
Sorry, forgot, that this was changed. And yes, it works ;-)
@Harry
Before working with different directories, you should make a test with main.sikuli and loginImport.sikuli in the same directory, since this is supported in rc3 without managing sys.path.
So this should work:
#content main.sikuli
import loginImport
loginImport.test()
#content loginImport.sikuli
from sikuli import *
def test():
popup("works!")
--- If you then decide to move your sub modules to another directory:
first you have to arrange sys.path before importing.
importPath = r"C:\path\to\my\imports"
if not importPath in sys.path: sys.path.append(importPath)
import loginImport
--- double backslash
if you use the raw string r"contains \ and more", you do not need to doublee the backslashes
so it should be: App.open(r"C:\Path\to\my\program")
restriction: a \ cannot be the last character in the string
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.