CERN Accelerating science

How to include a C++ notebook/file

Dear experts,

I just started using SWAN, and it’s my first time using Jupyter notebooks.
I created a SWAN project with a notebook in ROOT/C++ linked to my personal Github account, and I would like to share it via the Jupyter Notebook Viewer.
Since some of the code is just boilerplate, I would like to put it in a separate notebook or include file, so that the main notebook is focused only on the solution of the problem, not the actual implementation.
Is there a way to import/include other notebooks/files?
I found this page in the Jupyter documentation, but I think it only works for Python notebooks.

Best,
Claudio

Dear Claudio,

If you publish a notebook in the Jupyter Notebook Viewer, the site will only render your notebook, but it will not run it. So it does not really matter if the notebook is not complete and it uses some module whose code is not in that notebook.

If you want the boilerplate code to be accessible too, you can include a link to that boilerplate code (e.g. a python module on github, or another notebook on Jupyter Notebook Viewer) from a markdown cell of the first notebook.

Ah ok, good to know!

I see that if I create a cpp file in git, I can #include it successfully from the notebook and use the methods defined there.
Thanks for your help.