Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 Status: Open => Answered RaiMan proposed the following answer: Then you still have some naming conflicts. As mentioned: If you proceed to use this solution instead of switching to being pythonic, then you have to take care for having a strict naming convention, that does not lead to name clashes. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 Status: Solved => Open TC is still having a problem: Using the ugly hack (written like your earlier post), I sometimes get [error] script [ mainscript] stopped with error in line 6 [error] NameError ( name 'subscript' is not defined ) It definitely works sometimes. Sometimes when I run the sub-scripts individually, and then run the main script, it works, as if it warmed up the main script. It used to work right when I opened Sikuli. Not sure what is going on. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 RaiMan posted a new comment: --- the sub-scripts seem "locked" Since in the same session of the IDE, imports once done are not refreshed on rerun of the masterscript, any edits in imported scripts in the same IDE session are only reflected after restart of the IDE. With version 1.1.1 the first one will work, since imported SikuliX scripts are internally refreshed on rerun. But this would only help, if you switch to solution 1. ... and thanks for kind feedback. Have fun. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 Status: Answered => Solved TC confirmed that the question is solved: Interesting for the first one, once you run the master script, the sub- scripts seem "locked" and unable to edit (until restarting sikuli) But it is fine, the ugly hack works great. Thanks for the answer, I have no computer science background and your other answers always come up on google searches and it's helped me tremendously :) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 Status: Open => Answered RaiMan proposed the following answer: Python import only runs the imported script at first time, to learn about the names defined in the script. Import is usually used to make variables, functions and classes available in other scripts (DRY principle, reuse what already works). So the most Python-like way would be to wrap the code in the scripts into a def() : --- script 1 def script(): # existing code indented one level --- script 2 def script(): # existing code indented one level --- main script import script1 import script2 for n in range (3): script1.script() script2.script() without any changes you can do this "ugly hack": for n in range (3): if n == 1: import script1 import script2 continue reload(script1) reload(script2) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #438963]: How to loop a master script (one that runs other scripts)
Question #438963 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/438963 Description changed to: So I have 2 scripts (it was one before, but I had to break it up because it was too long). Call them script1.sikuli and script2.sikuli And I have a master script that runs them. The script1.sikuli and script2.sikuli are inside the master.sikuli folder. (I tried it when master, script1, script 2 were all in a single folder, same thing happens). So in master.sikuli I have written down: for n in range (3): import script1 import script2 When I run though, it goes through both scripts perfectly, but it stops after only one run. Any way to make this happen? -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp