I give Up. Docs make this seem simple enough, but just can't get it to work.
Hi
I have progressed in my skill that I want to start reusing functions by saving them and importing into other scripts.
I followed the docs. And that made it seem simple. But I keep getting [error] NameError ( global name 'click' is not defined)
So I followed another qquestion that said I would have to add the path to sys.path. I followed the provided example for theMain and theLib. That worked. So I added that to my script and still got the same error.
But I didn't really need to do that because the scripts are in the same folder.
So here are my scripts in the same folder:
TVTimeout.sikuli
-------
print "[Info1] This will only print once"
def Restart():
print "[Info2] This will print everytime function is called"
click(
wait(2)
if exists(
wait(2)
if exists(
wait(1)
if exists(
wait(1)
wait(10)
TestTV.sikuli
-------
TVTimeout.Restart()
After restarting IDE and running TestTV.sikuli, I get this in the message window:
-------
[Info1] This will only print once
[Info2] This will print everytime function is called
[error] script [ TestTV ] stopped with error in line 3
[error] NameError ( global name 'click' is not defined )
[error] --- Traceback --- error source first line: module ( function ) statement 5: TVTimeout ( Restart ) click(Pattern(
[error] --- Traceback --- end --------------
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask David for more information if necessary.