C7EMR - Python is the Python mod for C7EMR. It lets you write Civilization 7 mods in Python instead of JavaScript, running on Brython, a Python 3 implementation that compiles Python to JS in the browser.
- ✅ Loading and running
.pyfiles from your mod's own files - confirmed working end-to-end, including the standard library (brython_stdlib.js) and Python-level tracebacks on error.
Brython compiles Python to JS at runtime via eval()/new Function(), which only works if brython.js runs as a real top-level classic script, not bundled through rollup/commonjs. So this mod ships brython.js and brython_stdlib.js unmodified and loads them via a real <script src> tag, the same technique C7EMR - WASM's Go guide uses for wasm_exec.js.
- Write your mod logic in one or more
.pyfiles. - Declare them as
<ImportFiles>in your.modinfo(not<UIScripts>). - Write a small JS entry script that loads your main
.pyfile once this mod's loader is ready.
See the Python guide for the full walkthrough.
