# Integrate python file with 3d slicer

**URL:** <https://discourse.slicer.org/t/integrate-python-file-with-3d-slicer/24042>\
**Category:** Support\
**Created:** [June 25, 2022, 10:06am UTC](https://discourse.slicer.org/t/integrate-python-file-with-3d-slicer/24042 "2022-06-25T10:06:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfurnari](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gfurnari](https://discourse.slicer.org/u/gfurnari)\
**Post date:** [June 25, 2022, 10:06am UTC](https://discourse.slicer.org/t/integrate-python-file-with-3d-slicer/24042/1 "2022-06-25T10:06:53Z")

</div>

Hi everyone, i’m trying to use python code to automate a process that uses 3d slicer’s modules + some functions that i made myself. So basically i need to call 3d slicer’s modules, slicer.util, etc from my file, just like doing that on python console on 3d slicer, and interact with 3d slicer using my python file (i hope it’s clear what my problem is).  
I tried to create a new module with extension wizard but when i call “from slicer.util import …” it tells me that slicer.util is not found.  
Could it be an environment problem?

Thank you very much for your help.

---

<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:** [June 25, 2022, 4:19pm UTC](https://discourse.slicer.org/t/integrate-python-file-with-3d-slicer/24042/2 "2022-06-25T16:19:34Z")

</div>

Be sure you follow the examples carefully. This tutorial is a good one to show all the steps:

> **[Developing extension in 3D Slicer](https://docs.google.com/presentation/d/1JXIfs0rAM7DwZAho57Jqz14MRn2BIMrjB17Uj_7Yztc/edit#slide=id.g41f90baec_028)**
>
> Developing and contributing extensions for 3D Slicer Andrey Fedorov, PhD, Brigham and Women’s Hospital/Harvard Medical School Jean-Christophe Fillion-Robin, Kitware Inc. Steve Pieper, PhD, Isomics Inc. fedorov@bwh.harvard.edu First presented: Nov 18,...

There are more examples here:  
[https://www.slicer.org/wiki/Documentation/4.10/Training#Tutorials\_for\_software\_developers](https://www.slicer.org/wiki/Documentation/4.10/Training#Tutorials_for_software_developers)

If there’s a specific spot in one of the tutorials where things don’t work for you let us know which steps you followed.

---

<div class="post-metadata">

**Author:** ![gfurnari](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@gfurnari](https://discourse.slicer.org/u/gfurnari)\
**Post date:** [June 25, 2022, 5:15pm UTC](https://discourse.slicer.org/t/integrate-python-file-with-3d-slicer/24042/3 "2022-06-25T17:15:39Z")

</div>

Thank you @pieper for your quick reply. I’ll follow theese tutorials and let you know if i can’t solve the problem.
