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

Alan Gauld alan.gauld at btinternet.com
Fri Aug 31 23:19:27 CEST 2012


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

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list