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

I am aware of the documentation stating that importing another sikuli script 
requires "from sikuli import *" as one of if not THE first line of code.

However...

I am not importing a sikuli script, I am importing a function from a sikuli 
script: "from base import func1"

func1 contains a line: "type(Key.PRINTSCREEN)"

This is where my error is occurring. Whenever I call "func1()" in my other 
script, I get the error "global name 'Key' is not defined." I have tacked in 
the line "from sikuli import *" at the start of the base script. I have put it 
as the first line of func1 even. Neither of these solutions is stopping the 
error. Where do I put the "from sikuli import *" line when I am not calling 
"import base", but rather "from base import func1"?

The reason I'm doing it this way is because I want to be able to just call 
func1 without having to call base.func1. I have a number of scripts that 
utilize the func1 function, and want to be able to simply import it rather than 
have all of its code written out in each script. But since I've already got 
dozens of calls to it, it'd be time-consuming to change all add "base." onto 
the start of every call. If there's a more efficient way to handle this, I 
would appreciate the advice as well.

Thank you.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to