Here's a way:
Lets say you have three files, the first file (first_half.py) is for the first half of your program, the second file (ask.py) is where the user is asked whether or not to continue, and the third file (second_half.py) is for if the user chooses to continue, it gets executed.
In your first_half.py python file:
# Your code
import os
os.system('cmd /k "python ask.py"')
In a ask.py:
a = input("Do you wish to continue? ")
line = 5 # Choose which line of the second_half.py should define the variable
with open('second_half.py','r') as f:
file = f.readlines()
if a == 'y':
file.insert(line,'\na = "y"')
with open('second_half.py','w') as f:
f.write(''.join(file))
else:
file.insert(line,'\na = "n"')
with open('second_half.py','w') as f:
f.write(''.join(file))
import os
os.system('second_half.py')
This might not be what you're looking for, but does work for some specific situations.