threading – thread isn’t executing

  python

I’m learning threading in Python and tried to create a threading program as shown below

def main():
    print('Hello world!')

if __name__ == "__main__"
    thread1 = threading.Thread(target=main)

However when changing the target=main(), it executes but some parts of my code don’t work then
What am I doing wrong?

Source: Python Questions

LEAVE A COMMENT