# Run a Python script as subprocess from Slicer

**URL:** <https://discourse.slicer.org/t/run-a-python-script-as-subprocess-from-slicer/22668>\
**Category:** Support\
**Tags:** python\
**Created:** [March 24, 2022, 12:18pm UTC](https://discourse.slicer.org/t/run-a-python-script-as-subprocess-from-slicer/22668 "2022-03-24T12:18:09Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 28, 2022, 11:16am UTC](https://discourse.slicer.org/t/run-a-python-script-as-subprocess-from-slicer/22668/5 "2022-03-28T11:16:52Z")

</div>

You can get definitive answer by using a Python profiler, but a likely root cause is excessive logging. See more details here:

> [@Third party library works slower inside Slicer's Python shell - why? how to do performance profiling?](https://discourse.slicer.org/t/third-party-library-works-slower-inside-slicers-python-shell-why-how-to-do-performance-profiling/18742):
>
> Hi, I’m trying to use python package [lasio](https://github.com/kinverarity1/lasio). It is geological library and its main purpose is to read textual files of format .las After installing it (pip install lasio) I can use it as follows: import lasio las = lasio.read("path/to/las/file") # I provide an example file below The problem is that if I read this .las file (via command las = lasio.read("path/to/las/file")) in Slicer’s python shell then it works noticeably slower (about 5 seconds) than when I open PythonSlicer.exe in Window…

---

_[View the full topic](https://discourse.slicer.org/t/run-a-python-script-as-subprocess-from-slicer/22668)._
