I am wondering what is the best way to put together codes from different python files into a new python file.
Lets say the first file 1.pywould consist of:
def(...):
a=1
b=2
return c=a+b
Run Code Online (Sandbox Code Playgroud)
And another file 2.py consists of:
def(...):
d = 4
e = c*d
return e
Run Code Online (Sandbox Code Playgroud)
Now let's say you have a final file, final.py, which you want all the codes from 1.py and 2.py copied word by word to it in a specific order of operation where it looks as below. Note that I understand we can use the import function in python but in this case, I would like the whole text of certain definitions to be copied to the new python code. In another term, glue the codes from different files to build a new file.
final.py:
def(...):
a=1
b=2
return c=a+b
def(...):
d = 4
e = c*d
return e
Run Code Online (Sandbox Code Playgroud)
EDIT:
Rephrase above: what if file 1 has 100 definitions and file 2 has 100 definitions but I want specific ones from each file copied over to file 3 with full text and syntax in a specified order.