← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #197440]: error occurs when importing the files in the same directory

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I cannot see your directory structure, so here the principal:

# main.sikuli (in whatever directory)
# ...
myScriptPath = "D:\\function\\Function"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
import Function
# ...
Function.test(str)

# Function.sikuli (in directory D:\function\Function)
from sikuli import *
def test(str)
# ...

If main.sikuli and Function.sikuli are in the same directory, the
sys.path stuff is not needed.

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