"elis aeris" <[EMAIL PROTECTED]> wrote 

> ok, i can import them.
> 
> how do I use them though?

When you import the module the code is executed. 
If you have executable code rather than function or 
class definitions then it will be executed (print 
statements etc). Thats why its always good practice 
to wrap stuff in functions and then use an

if __name__ == "__main__":
    main()

Type construct to execute it, it makres reuse later 
much easier.

But to access the functions and variables you just 
call them with the module prefix as usual

import sys, mymodule

mymodule.doSomething()
sys.exit()

See? exactly the same as you would use sys...

There's a lot more on this in the Modules and Functions 
topic in my tutorial.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to