My use case : I am making a software that is able to run python scripts with some test cases . Just like the online editor that you see in Competitive Programming Websites like SPOJ/ Hackerrank /Code Forces etc.
I have searched SO and following are the solutions that I got for my problem :
- Using
import
statement to import the script and then test on the functions. - Using
os.system
to run the script. - Using
subprocess.Popen()
to run the script. - Using
runpy
module.
I am a newbie and really don't know what will be the best option for my case. I would love some guidance from the SO community.