sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #07906
Re: [Question #183431]: onChange runs without happening any change
Question #183431 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/183431
RaiMan posted a new comment:
Sure, it works. but an import needs only to be processed once per module
when this is loaded. The imported stuff is put into the modules global
context and can be used everywhere in the module.
In your case, the import has to be processed each time, when the def()
is called, since it has a local context with its own local namespace,
which is built again on each entry.
This is a huge wast of resources (stack memory and processing time).
There is no need at all, to have the imports inside the def()s. If you
put them on top of your script, it is all the same for your coding.
It might be, that you have only one def() per import. If this is the
case, you have to rethink your module concept.
Usually it is - example:
# module myLib
def x1(i):
...
def x2():
...
def x3():
...
def x4():
...
def x5():
...
# script main
import myLib
def func1(i):
myLib.x1(i)
for i in range 10:
func1(i)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.