Integrate python file with 3d slicer

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.

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

There are more examples here:

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.

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