Off the back this great answer in this post: Create a notebook inside another notebook in Databricks Dynamically using Python where it was shown how to create an entirely new notebook dynamically, my question is on inserting a command into an existing notebook.
Given that
ctx = json.loads(dbutils.notebook.entry_point.getDbutils().notebook().getContext().toJson())
notebook_path = ctx['extraContext']['notebook_path']
content = "some code"
is it possible to append content
into the notebook at notebook_path
?