← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209132]: var across module

 

Question #209132 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/209132

    Status: Answered => Open

Fabian is still having a problem:
In fact my project is like that :

main.py
-------
import myModule1,myModule2,...,myModuleN,sys

#Part I want to add
#if (sys.argv[1]=="foo"):EnableVerif=1
#else:EnableVerif=0

myModule1.mySub1()
myModule1.mySubN()
....
myModuleN.mySub1()
myModuleN.mySubN()


and each module is composed of a lot of Sub.
I want to add a global var (EnableVerif) that I can use in each module without adding EnableVerif in each sub.
EnableVerif is defined at the beginning of main following the argument and this value will never change after this initialization all along main execution.
I want to use EnableVerif in all module in this way :

myModule1.py
------------
import Verif

def mySub1():
	click("blabla.png")
	if (EnableVerif=="1"):Verif.Point1()
	....
	click("blablaN.png")
	if (EnableVerif=="1"):Verif.PointN()

Verif.py
--------
def Point1():
	if exists ("foo1.png"):print "OK"
	else:print "NOK"
....

def PointN():
	if exists ("fooN.png"):print "OK"
	else:print "NOK"

My project is already done and only this point is missing and I don't want to add EnableVerif var in each sub.
So I hope I was clear in my expectations and I hope there is a solution to this issue.
Searching with my friend Google, I found a __BuiltIn__ module but I have not understand how to use it.

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