As garvan says, it can be done without too much difficulty, but the
currently executing copy of the code is unaffected. A more usual way of modifying the behavior of a running script is an appropriate conditional within the script!

Of course, If you have a script that is scheduled to run periodically and you want to change what it does on its next run, you could do what you propose. Even here, though, a better approach might be to create one or more persistent 'flag' file(s) and have the script behave differently according to which file(s) is/are present.