diff --git a/src/bonsai/bonsai/bim/module/tester/operator.py b/src/bonsai/bonsai/bim/module/tester/operator.py
index 78ec9693f8..18b922f692 100644
--- a/src/bonsai/bonsai/bim/module/tester/operator.py
+++ b/src/bonsai/bonsai/bim/module/tester/operator.py
@@ -337,9 +337,21 @@ class StartIfcTesterWebapp(bpy.types.Operator):
websocket_server_thread = threading.Thread(target=run_websocket_server, daemon=True)
websocket_server_thread.start()
+ py_version = sys.version_info
+ bonsai_lib_path = (
+ Path(bpy.utils.user_resource("EXTENSIONS"))
+ / ".local"
+ / "lib"
+ / f"python{py_version.major}.{py_version.minor}"
+ / "site-packages"
+ )
+ env = os.environ.copy()
+ env["BONSAI_LIB_PATH"] = str(bonsai_lib_path)
+ env["BONSAI_VERSION"] = tool.Blender.get_bonsai_version()
+
# Start the Flask server as subprocess
webapp_process = subprocess.Popen(
- [sys.executable, webapp_serve_path, "--host", "127.0.0.1", "--port", str(webapp_port)]
+ [sys.executable, webapp_serve_path, "--host", "127.0.0.1", "--port", str(webapp_port)], env=env
)
# Update properties
diff --git a/src/bonsai/docs/guides/development/installation.rst b/src/bonsai/docs/guides/development/installation.rst
index eff5ef049e..e68d90aa00 100644
--- a/src/bonsai/docs/guides/development/installation.rst
+++ b/src/bonsai/docs/guides/development/installation.rst
@@ -174,6 +174,14 @@ If there are changes to the IfcOpenShell binaries, you may replace the two
``*ifcopenshell_wrapper*`` files with new ones downloaded from the automated
`IfcOpenShell builds directory `__.
+If you wish to run the IfcTester webapp, you will also need to have ``npm`` and
+setup IfcTester:
+
+.. code-block:: bash
+
+ cd src/ifctester
+ make webapp-prepare
+
.. seealso::
There is a `useful Blender Addon
diff --git a/src/ifctester/webapp/serve.py b/src/ifctester/webapp/serve.py
index 3eaf48d35c..245d50c38f 100644
--- a/src/ifctester/webapp/serve.py
+++ b/src/ifctester/webapp/serve.py
@@ -17,8 +17,18 @@
# along with IfcTester. If not, see .
import os
+import sys
import argparse
import mimetypes
+
+bonsai_lib_path = os.environ.get("BONSAI_LIB_PATH")
+print(os.environ)
+print(bonsai_lib_path)
+bonsai_version = os.environ.get("BONSAI_VERSION")
+
+if bonsai_lib_path:
+ sys.path.insert(0, bonsai_lib_path)
+
from flask import Flask, send_from_directory, send_file
# Browsers expecting this specific MIME type for .mjs files,