Search code examples
pythonmultithreadingarguments

Get Arguments of Thread Variable


I have a very simple question:

myThread = Thread(target=TestTarget, args=(1, Event(),))

Is it possible to get the arguments just using the Variable myThread?

Thank you!


Solution

  • After pilcrows answer - i use this working solution:

    from threading import Thread
    
    class myThread(Thread):
    
        args = None
    
        def __init__(self, group=None, target=None, args=(), name=None, kwargs = None, daemon = None):
            self.args = args
            super(RaThread, self).__init__(group=group, target=target, args=args, name=name, kwargs=kwargs, daemon=daemon)
    

    Thank you all for helping!