It depends.
To add on others answer, generally, unless you're using a hot reloading system, or the running code is reading the file you changed (like a config file or your own interpreted code), no, your changes wouldn't affect the running code.
This is because the process created to run compiled code includes dumping the code to main memory. And to change execution due to file modification requires compiling and executing it again.
For the link on python source modified, the S.O. answer states this happens when you're trying something funky with imports.