diff --git a/fasthtml/jupyter.py b/fasthtml/jupyter.py
index af6dfbf8..9d053082 100644
--- a/fasthtml/jupyter.py
+++ b/fasthtml/jupyter.py
@@ -118,7 +118,7 @@ def stop(self):
from html import escape
# %% ../nbs/api/06_jupyter.ipynb #89b8984b
-def HTMX(path="/", host='localhost', app=None, port=8000, height="auto", link=False, iframe=True):
+def HTMX(path="/", host='localhost', app=None, port=8000, height="auto", link=False, iframe=True, client=None):
"An iframe which displays the HTMX application in a notebook."
if isinstance(height, int): height = f"{height}px"
scr = """{
@@ -137,7 +137,8 @@ def HTMX(path="/", host='localhost', app=None, port=8000, height="auto", link=Fa
route = f'/{unqid()}'
res = path
app.get(route)(lambda: res)
- page = TestClient(app).get(route).text
+ cli = client if client is not None else TestClient(app)
+ page = cli.get(route).text
src = f'srcdoc="{escape(page)}"'
if iframe:
return HTML(f' """)
diff --git a/nbs/api/06_jupyter.ipynb b/nbs/api/06_jupyter.ipynb
index 0cc6c9de..00f4be40 100644
--- a/nbs/api/06_jupyter.ipynb
+++ b/nbs/api/06_jupyter.ipynb
@@ -725,7 +725,7 @@
"outputs": [],
"source": [
"#| export\n",
- "def HTMX(path=\"/\", host='localhost', app=None, port=8000, height=\"auto\", link=False, iframe=True):\n",
+ "def HTMX(path=\"/\", host='localhost', app=None, port=8000, height=\"auto\", link=False, iframe=True, client=None):\n",
" \"An iframe which displays the HTMX application in a notebook.\"\n",
" if isinstance(height, int): height = f\"{height}px\"\n",
" scr = \"\"\"{\n",
@@ -744,7 +744,8 @@
" route = f'/{unqid()}'\n",
" res = path\n",
" app.get(route)(lambda: res)\n",
- " page = TestClient(app).get(route).text\n",
+ " cli = client if client is not None else TestClient(app)\n",
+ " page = cli.get(route).text\n",
" src = f'srcdoc=\"{escape(page)}\"'\n",
" if iframe:\n",
" return HTML(f' \"\"\")"
diff --git a/pyproject.toml b/pyproject.toml
index bb2003fc..325ff14b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,3 +38,4 @@ include = ["fasthtml"]
[tool.nbdev]
jupyter_hooks = true
custom_sidebar = false
+lib_path = "fasthtml"