# import slicer doesn't work in python script

**URL:** <https://discourse.slicer.org/t/import-slicer-doesnt-work-in-python-script/21393>\
**Category:** Development\
**Tags:** python\
**Created:** [January 10, 2022, 9:16pm UTC](https://discourse.slicer.org/t/import-slicer-doesnt-work-in-python-script/21393 "2022-01-10T21:16:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJJ](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MJJ](https://discourse.slicer.org/u/MJJ)\
**Post date:** [January 10, 2022, 9:16pm UTC](https://discourse.slicer.org/t/import-slicer-doesnt-work-in-python-script/21393/1 "2022-01-10T21:16:09Z")

</div>

I want to automate generating a scene using python.  
I’ve created a .py file.  
But when I run:  
`import slicer`  
I get the following error:  
`ModuleNotFoundError: No module named 'slicer'`

If i load the slicer application it works fine, but I want to be able to build a scene file and add transform and link data to it, etc. from a python script without having to open the application.  
Is this possible?

Maybe I just dont have something installed?

Thanks!

---

<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:** [January 10, 2022, 11:29pm UTC](https://discourse.slicer.org/t/import-slicer-doesnt-work-in-python-script/21393/2 "2022-01-10T23:29:51Z")

</div>

Some things can be done using the `PythonSlicer` command and others can be done with the `--no-main-window` and `--python-script` options to the Slicer executable. Both are limited compared to the full app with rendering and all modules available so a lot depends on what exactly you need to do.

---

<div class="post-metadata">

**Author:** ![MJJ](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MJJ](https://discourse.slicer.org/u/MJJ)\
**Post date:** [February 3, 2022, 10:24pm UTC](https://discourse.slicer.org/t/import-slicer-doesnt-work-in-python-script/21393/3 "2022-02-03T22:24:58Z")

</div>

Thanks. that seems to be sufficient for my purposes!
