← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #289066]: Variable values not carrying over to functions called from separate scripts

 

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

Description changed to:
My scripts are as follows:

AdA1:
Contains all of the variables necessary to fill out an ad on a local website for my handyman business, imports two other scripts for their functions, and calls a function called runAd() at the end. There are also about a half-dozen copies of this script, with different values for the same variables, to help me diversify the content of my ads. 
http://pastebin.com/jZ7RcECg

Ad_Lib: 
Contains all of the graphical elements Sikuli needs to navigate the website, defined as variables, to be accessed by the other scripts and their functions, as needed. 
http://pastebin.com/qZ2TVPpD

Ad_Function:
The actual code that navigates the web page, types/pastes the values from the variables in Ad1, and clicks/interacts with the graphical elements from Ad_Lib. Basically the entire contents of this script are defined as the function runAd(), which gets called at the end of AdA1. 
http://pastebin.com/59EBEZdA

Here's the problem: 
When I had all of these functions and variables stored in a single script (a previous version of AdA1), it all worked flawlessly. But now that I've broken out the functions of the script into their own modules, and called them from one another, the variable values don't carry over from Ad1 into the function it calls from Ad_Function. How can I make it so that when I set a variable value in the one script, that value carries forward into all scripts and functions called henceforth? I played around a bit with using the "global" keyword, but it doesn't seem to help.  Please be gentle with me. I'm still a Python beginner. Where have I gone wrong?

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.