← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #290844]: Problem with (cross) importing user-defined functions

 

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

Description changed to:
Hi all,
before asking this question I already looked for another solutions in this forum/ google and tried different scenarios but I had no success :-(. I hope someone can help me. 

Let´s say I have following implementation. All my scripts, images etc. are in the folder "firstProject" and the folder has following structure/contents
- C:/firstProject/main.sikuli
- C:/firstProject/main.sikuli/main.py
- C:/firstProject/lib
- C:/firstProject/lib/secondary.py
- C:/firstProject/lib/images.sikuli/images.py
- C:/firstProject/lib/images.sikuli/start_button.png

Besides all folders "firstProject", "main.sikuli", "lib", images.sikuli"
have an empty "__init__.py" file.

- The start_button.png is the Windows start button. 
- C:/firstProject/lib/images.sikuli/images.py contains following code (> is not in the code, only for better reading)
    > STARTBUTTON = "start_button.png"
- C:/firstProject/lib/secondary.py contains following 
   > from images import *
   > def start(): 
   >          click(START_BUTTON)
- C:/firstProject/main.sikuli/main.py contains following 
   > myScriptPath = "C:\\firstProject\\lib"
   > if not myScriptPath in sys.path: sys.path.append(myScriptPath)
   > from secondary import * 
   > start()

I dont know why the start() does not click the windows button if I run the script. 
I also try to move "secondary.py" to a folder C:/firstProject/lib/secondary.sikuli (and remove "from images import *") but without success. What can I do else? Does anyone have a solution for this problem? Thanks a lot!

Kind regards
Tu Mi

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