← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #159700]: how to import all the sikuli files in one directory (myLib folder)

 

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

    Status: Open => Answered

eliteSKL proposed the following answer:
"ImportError: No module named myLib"  double check the name of the file
and location. make sure your import statements are after the myPath part


okay i have files in this folder:
c:\ABunchOfSikuliFiles
        scriptA.sikuli
        scriptB.sikuli
        scriptC.sikuli

If i want those to import correctly i will need this line of code at the
top of those files --> from sikuli.Sikuli import *

now i make my new file that is doing to do some importing.

c:\ABunchOfSikuliFiles
        MyNewAwsomeScript.sikuli
        scriptA.sikuli
        scriptB.sikuli
        scriptC.sikuli

the lines of code at the top of MyNewAwsomeScript.sikuli are:

import os

myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)

import scriptA.sikuli
import scriptB.sikuli
import scriptC.sikuli

scriptA.afunctionFromhere()
scriptB.AfunCtionfromHERE()

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