How to enter a Python console script at different parts of it?
I would like to know how to enter a Python script at different parts of it. E.g. if the script consists of 10 console commands run after one another and I close my terminal after 5 (or manually stop there), I would like to be able to start the script from the 6th command. If I closed it after the 7th command, I would like to start with the 8th command and so on. So, one way would be to have a number Parameter by executing the script that tells where to start. But how do I include it? Just hard-coding if Parameter < x over each and every step to start there seems a bit odd.... However, I guess it would look like that: if Param < 2 Do step 1 If Param < 3 Do step 2 If Param < 4 Do step 3 ... But I guess there must be a better solution to this. Does anyone have any idea on it? :) Edit: I don't want to catch the moment I left the terminal, I could find that out otherwise. I just want to be able to start my script from that/any point. E.g. with "python3 my_script --step 4" -> start at step 4.