Syed Naqi Syed Naqi - 10 months ago 58
Python Question

how can I access functions from another program into my new program

I'm trying to write a program that is related to another program, so how can I access the individual functions from my previous program and work with them as required, I know you are suppose to import that program but what to do after that.
The program that I import how can I use functions from it.

Answer Source

It would be better if you write code. I assume your 1st code is and you want to use fun1 from it in Put them in same directory . . .


import code1


from code1 import *

Note: 2nd method is not recommended.