The simplest way (which isn't simple at all) would be to first write a program in a compile-able language like c or c++. This program would open itself and look for a delimiter of when the next program begins.
Example:
[exe header][code]{delimiter}[program2]
From there you can read that code and write it into a new exe file (if the second program is a exe) or multiple other ways. Then run the second program. Python could be used to pack the second program onto the first one but...
This is almost exclusively used for malicious programs as the "unpacking" program can be made to not be detected by anti-viruses and the malicious program can be encrypted. Due to this, this is as far as I will go and I won't be giving any examples.
If you have any specific questions about code your working on like errors or unexpected results I am sure many people would be up to helping you. Please let me know if you have any questions!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…