Create a thread

    0

    11

    Python public recipes

    This code creates a new thread that calls the target_function with the arg1 argument. The new_thread.join() method causes the new thread to end and return to the main thread.

    Shortcut: threading.create

    import time
    import threading
    
    new_thread = threading.Thread(target=target_function, args=(argument1,))
    new_thread.start()
    new_thread.join()
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.