# I am Using threading in robotframework through a custom library and ran the keywords in a parallel manner After the execution the reports are not generating properly

**URL:** <https://forum.robotframework.org/t/i-am-using-threading-in-robotframework-through-a-custom-library-and-ran-the-keywords-in-a-parallel-manner-after-the-execution-the-reports-are-not-generating-properly/5315>\
**Category:** Robot Framework\
**Created:** [14 February 2023 07:50 UTC](https://forum.robotframework.org/t/i-am-using-threading-in-robotframework-through-a-custom-library-and-ran-the-keywords-in-a-parallel-manner-after-the-execution-the-reports-are-not-generating-properly/5315 "2023-02-14T07:50:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harsha](https://avatars.discourse-cdn.com/v4/letter/h/e274bd/32.png) [@Harsha](https://forum.robotframework.org/u/Harsha)\
**Post date:** [14 February 2023 07:50 UTC](https://forum.robotframework.org/t/i-am-using-threading-in-robotframework-through-a-custom-library-and-ran-the-keywords-in-a-parallel-manner-after-the-execution-the-reports-are-not-generating-properly/5315/1 "2023-02-14T07:50:28Z")

</div>

After the execution the reports are not generating properly  
[reports and log link](https://harshavardhan-2001.github.io/sample_threading/)  
Here is the python code for threading

import threading  
from robot.libraries.BuiltIn import BuiltIn

thread\_list =

class thread\_that\_runs\_kw(threading.Thread):  
def **init** (self, name, kwname, \*args):  
threading.Thread. **init** (self)  
self.name = name  
self.kw = kwname  
self.args = args  
self.result = None

```
def run(self):
    print("starting thread: %s" % self.name)
    self.result = BuiltIn().run_keyword(self.kw, *self.args)

```

```python
def run(self):
    print("starting thread: %s" % self.name)
    self.result = BuiltIn().run_keyword(self.kw, *self.args)

```

def wait\_for\_threads():

```python
return_dict = {}
for thread_obj in thread_list:
    thread_obj.join()
    return_dict[thread_obj.name] = thread_obj.result

return return_dict

```

def run\_kw\_in\_thread(thread\_id, kw, \*args):  
t = thread\_that\_runs\_kw(thread\_id, kw, \*args)  
thread\_list.append(t)  
t.start()

Robot test file

\*\*\* Settings \*\*\*  
Library threads.py

\*\*\* Test Cases \*\*\*  
Run multiple threads  
run kw in thread thread-1 keyword1  
run kw in thread thread-2 keyword2  
${k}= wait for threads  
log to console harsha  
Log to console ${k}

\*\*\* Keywords \*\*\*  
Keyword1  
log to console 11  
sleep 8  
log to console 15  
[Return] 20 30  
Keyword2  
log to console ka  
sleep 5  
[Return] 10
