execute python file from another file
I have a python file that has functions and classes. now I am writting another program (in another file). and I want to start the new file with running the old file (with the function and classes). I have tried using开发者_JAVA技巧 exec(path_2_oldFile.pyw) but it didn't work.
thanks for any help Ariel
Ideally you should try and import the first file into the new as a module using the import
statement:
http://effbot.org/zone/import-confusion.htm
You'll need to make sure that your original module is on the python path somewhere. If it is in the same directory as the new file this should just work.
精彩评论