How to import and use py file in Pythonx and deploy precompiled file beside Rustler

Hello.
I’m working on a project where I’m currently using Rustler, and I want to integrate Pythonx as well. Additionally, I need both Python and Rust code to be precompiled and bundled into a single binary file for my project. My goal is for the end-user to download only one binary file, without needing multiple separate files.

I’ve already managed to achieve this for the Rust part, but I couldn’t find anything relevant in the Pythonx documentation about bundling or precompiling Python scripts directly into the final binary.


My next question is:

Is there a way to have a separate directory containing Python scripts, and then import and execute these Python files through the Pythonx.eval function in Elixir, instead of embedding the entire Python code as strings within the Elixir code?

Finally, how can I package everything into a single, precompiled binary for each operating system and use does not need to have python installed?

By the way, my ci is same this for precompiling: wasmex/.github/workflows/release.yml at main · tessi/wasmex · GitHub

Thank you!

Hi friends, I got all my answers here:

1 Like