Two things: First, the "my_script.py" is the program you want to run to get output from. I just used a Python script as an example. This line could just as easily be:
output, error = run_command('ls', '-l') to list all files in a directory (though you would typically use Python's os module for this). Again, the command can be anything that you would type yourself, with the exception that arguments need to be in a list format (in other words, you can't use 'ls -l' as the command, you have to split it up into 'ls', '-l'). Secondly, this may not be the best thing for you to try as a beginner. Doing things like this requires managing multiple processes, which makes things much more complicated. If you must do this right now, then use the first example I gave (that blocks until the command is complete). That is the easiest way. Trust me, if you are uncomfortable with this, then having to sync up multiple processes to do live streaming of output will be a nightmare for you, no matter what route you take.