Q:

Python script is dependent of another .exe. Is it possible to merge both into one single .exe?

I am writing a short script.py which will update archive.tar. 
The tar archive's content is one single file: file.txt (Content: "Hello").
I am using 7za.exe which is the the command line version of 7zip to update file.txt with another file.txt (Content: "Hello world"). I am using the following command:
os.system("7za u archive.tar file.txt")
So far everything is working, however I would like to create an executable from the Python Script using PyInstaller, since not everyone using this script will have python installed.
My question: is there a way to merge both script.py and 7za.exe into one single .exe file?
So far, I have not been able to find an answer.

A:

Why not simply using the ZipFile library? 
This could be as simple as:
with ZipFile('spam.zip', 'w') as myzip:
    myzip.write('eggs.txt')

If you really want to use a third party then no, there is no simple way of doing what you want to do. The only "clean" way would be to pack your executables together by using an installer, like the ones you could create with Innosetup

NB: You should prefer the use of subprocess rather that os.system, see there https://docs.python.org/fr/3/library/subprocess.html#replacing-os-system 

Update: For a tarfile, maybe these could help you: 

How to append a file to a tar file use python tarfile module?
How can files be added to a tarfile with Python, without adding the directory hierarchy?

Maybe you'll have to decompress / add / recompress, but you should be able to do it in memory.

