Python Forum

Full Version: How to terminate the caller fuction through callee?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my code:

def callee():
    # implement a code to stop the execution of caller()


def caller():
    callback1 = callee
    do_somthing()

callback2 = caller
Thanks in adavance.
I suggest
def callee():
    raise RuntimeError
def callee():
    return 'Die!Die!Die!'
  
def caller():
    callback1 = callee
    if callback1 != 'Die!Die!Die!':
        do_somthing()
 
callback2 = caller