I am interested in creating a Notebook with specific instructions in an automatic fashion using, say, Python. For example, I would like to generate the file NewNote.nb (a genuine Mathematica Notebook, and not merely a .nb file) with the instruction
so that, after running my Python program, I could open NewNote.nb as I open a regular Notebook, and run it as a regular Notebook, thus getting the output 4, as expected. I do not want to run the Notebook in an automated way: all I want is to create it in such automated way.
The problem I am facing, however, is that a Mathematica Notebook has lots of internal cache informations; and if I generate a .nb file without them, it will not work as a genuine Mathematica Notebook.
Thanks in advance