Launch external script

I have made my own application with electron, and I encounter an issue with production builds, when it comes to launching an external script.

When I run the code in the dev environment, I have something like:

spawnSync(PYTHON_LOCATION, args);

and it works well because PYTHON_LOCATION is public/ .

However, when I use electron-builder to make an AppImage, this does not work because the script can’t obviously be found. An AppImage application comes as a single file and it’s obvious that the public directory is not exported with it.

Is there a way to launch the python script directly within the AppImage? I mean how should I bundle the app to still have access to this python script and be able to execute it since an AppImage comes as a single file?

Is there a solution to this issue?