sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #41348
Re: [Question #446323]: Script runs twice when it is imported
Question #446323 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/446323
Status: Open => Answered
RaiMan proposed the following answer:
if your imported modul has runnable code on indent level null (not in
def()'s nor in classes), then this code is run at import AND reload.
Generally an imported module should only have code, that only does
something when using a name defined in the module (e.g. calling a
function or using a variable that has its content defined in the
module).
Hence for the average SikuliX scripts everything in a module should be
packed into def()'s.
If you want to run code by importing it, the feature runscript is much better.
BTW: with version 1.1.1 the reload for .sikuli is done internally automatically (not needed anymore).
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.