How to Execute a Notebook Within a Notebook: Is It Possible and How?

14 Replies, 583 Views

Hey! I’ve been using `papermill` for a while now, and it’s perfect for executing a notebook within a notebook. It’s super easy to set up and has great documentation. Here’s a quick example:

```python
import papermill as pm

pm.execute_notebook(
'input.ipynb',
'output.ipynb',
parameters={'foo': 'bar'}
)
```

This will run the notebook and save the results to `output.ipynb`. You can even pass parameters to customize the execution.

If you’re looking for something more lightweight, `nbconvert` is another solid option. It’s a bit more manual, but it gets the job done.

Hope this helps!

Messages In This Thread



Users browsing this thread: 1 Guest(s)