← Back to team overview

sikuli-driver team mailing list archive

[Question #216856]: help importing modules

 

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

im trying to modularize a macro i use at work but i cant figure out how to import the functions. i use windows 7 in the office and windows 8 at home and the idea is to have a script(s) i can zip up and share easily.  for the moment i have a test folder set up like this:
\test_folder
    -functions.sikuli
    -test.sikuli
the test_folder contains only the two .sikuli folders
the code in functions.sikuli looks like this:

def rtb(): #test function
    r = Region(4,106,88,100)
    r.hover("1355538617821.png")
    return

the code in test.sikuli looks like this:

import os
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
import functions
rtb()

and i get this error message when i run test.sikuli from the IDE:

[error] Stopped
[error] An error occurs at line 5
[error] Error message: Traceback (most recent call last):
 File "C:\Users\robert\AppData\Local\Temp\sikuli-tmp6921701362547521901.py", line 5, in 
 rtb()
NameError: name 'rtb' is not defined

i read the faqs and some questions answered on the forums and i tried importing the functions a few other ways but im stuck. any help would be appreciated.




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