I know it's late, but I wanted the same, and here is what I did:
Create another Python file in your code directory:
import time st=time.time() import test print("----%.2f----"%(time.time()-st))
where test is the name of your program. Therefore, if you want to run a program, just run it from here by simply changing the test.
Keep in mind that import runs the code normally if you have not used:
if __name__=="__main__":
Vedant kandoi
source share