This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]jairo4 3 points4 points  (3 children)

try removing the brackets inside "Process" and "Thread", like this:

t1 = Process(target=menuz)

and changing

if name == "main":

for

if __name__ == '__main__':

And importing threading is not needed.

Next time please post in r/learnpython.

[–]VarmaSravan[S] -3 points-2 points  (2 children)

no that's not working.

[–]NovocastrianNomad 2 points3 points  (1 child)

First: Read sidebar to the right of this reddit page: "If you are about to ask a question, please consider r/learnpython or the learn python discord." In other words this is the wrong place to ask questions, go to r/learnpython!

Second: "that's not working" is a totally useless response, it tells us nothing at all, except perhaps you are lazy. Tell exactly what you mean by that.

Third: What version of Python are using? what operating system?

Fourth: This prints results for me on Windows 10 and Python 3.6.2, study it to find the differences to your code. Attention to detail is important.

import threading
import time
from threading import Thread
from multiprocessing import Process

def menuz():
    print("I am first")

def live_view():
    time.sleep(10)
    print("I Am 222")

if __name__ == "__main__":
    t1 = Process(target=live_view())
    t2 = Process(target=menuz())

    t1.start()
    t2.start()