This guide walks you through installing esem-bridge, writing a small Python module, and calling it from a Node.js script. By the end you will have a working bridge between JavaScript and Python with zero server setup. You need Node.js 18+ and Python 3.8+ installed on your machine.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Crane04/esem/llms.txt
Use this file to discover all available pages before exploring further.
Using the python() helper
The python() helper is the recommended way to load a Python module. It works in any Node.js ESM script with no extra flags.
Write a Python module
Create a file called
tools.py in your project directory. This module exposes a greet function, a multiply function, and a Counter class.tools.py
Call it from JavaScript
Create
index.js. Use python() to load the module, then call its exports like regular async functions. Instantiate Counter by calling it like a function — await Counter(5) returns a live proxy of the Python object.index.js
You do not need to call
shutdown() in short scripts. esem-bridge automatically unrefs the Python worker when no calls are active, so Node.js exits naturally once your script finishes. In long-running applications the worker stays alive and is reused across all python() calls.Using the python: import syntax
If you prefer static ESM import declarations, esem-bridge provides a Node.js loader hook that intercepts python: specifiers and synthesizes a live module proxy on the fly.
Write your JavaScript file using the import syntax
Replace the
python() call with a standard import statement using the python: prefix. Everything else — calling functions, instantiating classes, reading constants — works the same way.index.js