Python Forum
How to terminate the caller fuction through callee? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to terminate the caller fuction through callee? (/thread-22796.html)



How to terminate the caller fuction through callee? - 100k - Nov-27-2019

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.


RE: How to terminate the caller fuction through callee? - Gribouillis - Nov-27-2019

I suggest
def callee():
    raise RuntimeError



RE: How to terminate the caller fuction through callee? - jefsummers - Nov-27-2019

def callee():
    return 'Die!Die!Die!'
  
def caller():
    callback1 = callee
    if callback1 != 'Die!Die!Die!':
        do_somthing()
 
callback2 = caller