There are many ways to instruct a script to do something external to the script.
Pick which one works best for you
I don’t understand the question.
An invoked script will run until completion, if that script opens a socket then it should stay running as the socket being open prevents completion.