I have the file main.py
containing the code
def my_function():
a = 0
b = 1
c = 2
if __name__ == "__main__":
my_function()
I execute this script from a terminal / shell.
If I run the script with python -i main.py
all the variables are already gone because the function my_function
has ran out of scope.
How do I interrupt the running of the script after the command a = 0
and set a
to the value 1?
EDIT My goal with this question is to learn how I can apply some commands on variables that are the result of a function, even after the function has finished. So the code I wrote above is just a (minimum working) example.