# Threading in Slicer 3d

**URL:** <https://discourse.slicer.org/t/threading-in-slicer-3d/13931>\
**Category:** Support\
**Created:** [October 8, 2020, 5:40am UTC](https://discourse.slicer.org/t/threading-in-slicer-3d/13931 "2020-10-08T05:40:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chintha\_Siva\_Prasad](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chintha_siva_prasad/32/7766_2.png) [@Chintha\_Siva\_Prasad](https://discourse.slicer.org/u/Chintha_Siva_Prasad)\
**Post date:** [October 8, 2020, 5:40am UTC](https://discourse.slicer.org/t/threading-in-slicer-3d/13931/1 "2020-10-08T05:40:30Z")

</div>

I am creating a progress bar in slicer. But when using threads slicer is exiting abnormally.

 ![Screenshot from 2020-10-08 11-04-13](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/8/183ed92fdf75208452deee30f0ce8a8c7a6ecb8a.png)  
This the runnable I created ![Screenshot from 2020-10-08 11-04-46](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/b/8bb2be313edb0edca2df9d991fde040939777c1f.png)  
This is the driver code  
 ![Screenshot from 2020-10-08 11-04-26](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/1/f16f5780b17ff256aa6b20be5e98f9d5c5ab799e.png)

Why is the slicer exiting? Can I know how to create a progress bar in slicer qt that will get progressed on a thread?

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [October 8, 2020, 4:57pm UTC](https://discourse.slicer.org/t/threading-in-slicer-3d/13931/2 "2020-10-08T16:57:13Z")

</div>

Do you need a separate thread? Have you tried slicer.util.createProgressDialog()? You might find these examples helpful: [Use progress bar from python](https://discourse.slicer.org/t/use-progress-bar-from-python/4343)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [October 8, 2020, 7:12pm UTC](https://discourse.slicer.org/t/threading-in-slicer-3d/13931/3 "2020-10-08T19:12:37Z")

</div>

You need to be very careful with threads in vtk and python. Another alternative is to start processes instead. [Here’s a prototype implementation](https://github.com/pieper/SlicerProcesses) that works well.
