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

Alan Gauld alan.gauld at btinternet.com
Sat Sep 1 01:58:51 CEST 2012


On 31/08/12 22:51, Ray Jones wrote:


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

Creating a module is just a matter of creating a standard python file

<--------start of myvar.py ----->
#! /bin/python    # you don't even really need a shebang for modules!
myVar = 66
<-------- end of myvar.py ------>

import myvar
print myvar.myVal


And so long as the location of the module is in your sys.path
(or in the PYHONPATH environment variable) python will find it.



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



More information about the Tutor mailing list