OK, you are not giving much information, but I adapted a similar answer that I gave in other post, because I think it could give you the solution.
the example is with Threads, because is the first thing that came to my mind to do what you want. One Thread (func_control) takes care of the input and the other (func_1) does the real job.
The idea is that when you press Enter the function doing the job will pause or resume. It is important to have the sleep(0.1)
in order to not overload the CPU. I have not included anything to finish the execution, but I think you can do that alone... ;-)
Enjoy!
from threading import Thread
def func_control():
global switch
switch = 1
while True:
if switch:
print "I'm doing stuff. Press Enter to pause me!"
else:
print "I'm doing nothing. Press Enter to resume!"
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
line = raw_input()
switch = 0 if switch == 1 else 1
def func_1():
while True:
if switch != 0:
# Put all you need to do here!
pass
else:
sleep(0.1)
return 0
switch = 1
myThread1 = Thread(target=func_1)
myThread1.daemon = True
myThread1.start()
func_control()