2

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 exec(path_2_oldFile.pyw) but it didn't work.

thanks for any help Ariel

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but I dont want to use it as a module, I want to run it (like F5 does in idle).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.