os.system questions

David Brochu brochu121 at gmail.com
Sat Mar 31 17:26:41 CEST 2007


>
>
>
>
>
> From: "Eric Price" <soyouthinkimgonnalikethis at hotmail.com>
> Date: March 31, 2007 9:38:53 AM EDT
> To: soyouthinkimgonnalikethis at hotmail.com, khemkaamit at gmail.com
> Cc: python-list at python.org
> Subject: Re: os.system questions
>
>
> Oops! The problem isn't in the os.system call. It's in the fact  
> that I don't call the function. That is, I write a script called  
> "test.py" with a function in it called "freshReboot". Now, how do I  
> call that function from test.py? That is, how do I write a cron  
> event such that "freshReboot" actually gets called when I run test.py?
> TIA,
> Eric


 >>> Eric - to call a function that is located inside another module  
you first need to import that module into the program you are running:


from test.py import * # this would import all functions from test.py
from test.py import freshReboot # this will import freshReboot from  
test.py


to call freshReboot in your program you would simply call it by it's  
name freshReboot

ex: x = freshReboot()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070331/1ff43495/attachment.html>


More information about the Python-list mailing list