Importing Custom sikuli module - [error] NameError ( global name 'click' is not defined )

Asked by Zoran Lisovac

I have a utility sikuli module that I would like to reuse throughout other sikuli modules

my util file looks like:

from sikuli import *

def helperMethod1():
    ...

def helperMethod2():
   ...

So it has from sikuli import * at the beginning.

And where I consume it, it's loaded like:

utilFunctionsPath = 'MyDir\UtilFunctions'
if not utilFunctionsPath in sys.path: sys.path.append(utilFunctionsPath)

import UtilFunctions

I tried also with the reload(), and read other people's posts too, but the problem persists no matter what.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

what version of Sikuli?

how do you run the main (consuming) script?

in any case:

utilFunctionsPath = 'MyDir\UtilFunctions' # this must be an absolute path and
utilFunctionsPath = 'MyDir\\UtilFunctions' # backslashes must be doubled or
utilFunctionsPath = r'MyDir\UtilFunctions' # you use the raw string notation

if not utilFunctionsPath in sys.path: sys.path.append(utilFunctionsPath)

Can you help with this problem?

Provide an answer of your own, or ask Zoran Lisovac for more information if necessary.

To post a message you must log in.