开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜