← Back to team overview

sikuli-driver team mailing list archive

[Question #171825]: Importing Sikuli Script, Sikuli Specific functions "not defined" (in Sikuli IDE)

 

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

I am attempting to use a Sikuli Script as a module for other scripts in my automation suite (its actually launching the program, making it a module makes me not have to copy/paste it at the beginning of each script, and also makes the scripts independent, as they don't have to rely on the program already being open)  Here is some code:

Script I'm Importing (importLogin.sikuli)

from sikuli import *
import sys
#this is/was a test function (duh) to quickly determine if the import "worked"
def test():
    popup("works!")

def launch():
    App.open("C:\Path\to\my\program")


Script that I'm importing to:

import loginImport


importPath = "C:\\path\\to\\my\\imports"
if not importPath in sys.path: sys.path.append(importPath)

loginImport.test()


This throws a "NameError: global name 'popup' is not defined"   

I feel like i have (but probably haven't) done everything required as laid out in the Sikuli Documentation: http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images




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