-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
FYI - here is how to load code from a shared python file into a QMD file.
Ensure there is an init file in the docs/lib dir.
Contents of the docs/lib/urls.py file:
# docs/lib/urls.py
def data_file_url():
return "..."Contents of the QMD file:
# docs/notes/fetching-data/json.qmd
```{python}
#| echo: false
import sys
import os
# Go up two parent directories to reach the 'docs' root folder
project_root = os.path.abspath('../..')
sys.path.insert(0, project_root)
```
```{python}
from lib.urls import data_file_url
# the URL of some JSON data we stored online:
request_url = data_file_url("gradebook.json")
print(request_url)
```
Metadata
Metadata
Assignees
Labels
No labels