[Tutor] Using a calling program to change Python script arguments

Ray Jones crawlzone at gmail.com
Fri Aug 31 23:51:40 CEST 2012


On 08/31/2012 02:19 PM, Alan Gauld wrote:
> On 31/08/12 18:05, Ray Jones wrote:
>
>> script and have it parse. Is there another method for one Python script
>> to call/import/execute a Python script and integrate the name space so
>> that the variables in each of the calling scripts would be directly
>> usable by the Python module/child process/whatever without passing
>> arguments either via line arguments (yeccchhh!) or function calls
>
>
> Just create a module with the variables in it.
>
> Then import and access that module data in all your scripts.
>
> eg.
>
> import mysitedata
> print mysitedata.myValue
Backasswards was I again. I was thinking of loading the main from my
calling program.

I will try that. The only thing I would have to pass on the command line
then is which module I want to import for the site I want to access.

Okay. Now I must figure out how to create the module and have my calling
script look in the right place.... ;)

Thanks.


Ray


More information about the Tutor mailing list