global name 'Key' is not defined error with imported function
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.
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.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- William Dalphin
- Solved:
- Last query:
- Last reply: