← Back to team overview

sikuli-driver team mailing list archive

[Question #675326]: When creating an Env.addHotkey, using an import function as the handler causes the hotkey to trigger as soon as you start the script.

 

New question #675326 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675326

Using two scripts in conjunction here. I will use scripts 'A' and 'B' as my examples with functions to match:

#######scriptA.py#######
from sikuli import *


def a():
    print ("hello world")


#######scriptB.py#######

import scriptA
from scriptA import a

Env.addHotkey('b',KeyModifier.ALT+KeyModifier.CTRL, a)

---------------------------------------------




The result here is that as soon as you launch script B, the function 'a' will trigger. If you move this function into scriptB.py, then the hotkey works as intended.



Does anyone have any suggestions? RaiMan, you're my only hope!

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