← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209132]: global variable across modules

 

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

RaiMan posted a new comment:
@ Fabian
So your most simple final solution for your problem is:

-- in the main module

import sys
# check the parameter
if len(sys.argv) > 0 and sys.argv[1]=="foo": EnableVerif=1
else:EnableVerif=0

for i in range(n):
    exec("import myModule%d"%(i))
    exec("myModule%d.EnableVerif=EnableVerif"%(i))

After this your modules are prepared and can be used.
No need to change anything in the myModule...

And down the road you might change EnableVerif in any of your modules by
using:

myModule1.EnableVerif=0 # or some other value

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