For instance, say I have some snippet of self-contained code in a cell,
In [1]
from sys import argv
print(argv[1])
I want to be able to pass a value to the code in that cell, presumably through magic, so that
In [2]
%expelliarmus "In [1]" 69105
outputs
69105
Is there any simple way for me to do this, ideally without having to write the cell to my disk as a script?
Edit: I can't just wrap it in a function because in the notebook I'm working in (not the example I posted above) I'm trying to test stuff out with the argparse module.