Question

i am working on the following script,

import os
from multiprocessing import Process
import threading
def sample1():
    os.system('start cmd /k python script1.py')

def sample2():
    os.system('start cmd /k python script2.py')


def main():
    p1 = threading.Thread(target=sample1)
    p2 = threading.Thread(target=sample2)
    p1.start()
    p2.start()



if __name__ == '__main__':
    main()

This works well in windows(python), but is it possible in linux using the terminal??.

What i required is "command prompt in linux". How to get it, any ways??

Was it helpful?

Solution

If you want to launch a terminal where you can see output of your script you can use:

os.system("xterm -hold -e python script1.py")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top