Here is a simple test script:
import time
import threading
def task():
while True:
print ('x')
time.sleep(1)
threading.Thread(target=task).start()
Just save it in the packages folder. You will see as expected:
reloading plugin User.test
x
x
After deleting the plugin it gets unloaded, however the thread is still active:
unloading plugin User.test
x
x