You can execute code from previous sessions with %recall
. See %recall
documentation here.
#Execute all code from previous session.
%recall ~1/
#Execute all code from two sessions previous the current session.
%recall ~2/
#Execute lines 1 to 5 from previous session.
%recall ~1/1-5