Saturday, 15 March 2014

python 3.x - Run one .py file from another .py file -


I have created a program that calculates the size of files I have created another program that sends mail to the user. Program names are filesize.py and mailsend.py respectively. Mailsend.py is working perfectly, when I run it, I can see the mail in my Gmail inbox. But I want to run this code from mailsend.py filesize.py

I have done this file in filesize.py: (I'm sure what I'm trying to do is stupid, but I Programming is the only dragon)

  import Mailsend.py cmd = "python mailsend.py" os.system (cmd)   

and this does not work Any suggestions?

Change Import mailsend.py to import os .

The recommended method is ...

mailsend.py

  DIF main (): # old ` Mailseng 'content here if __name__ ==' __main__ ': main ()   

filesize.py

  import mailed mails .man ()    

No comments:

Post a Comment