How to execute a python code from spyder in the python console that is inside Slicer?

I have written my own image registration code in Spyder and want to run it in 3D slicer to see if my code works. How do I do this?

Spyder does not know how to instantiate all the application classes that you may need to use in your Slicer scripts. Instead, you can start the Slicer application, which can execute your script. You can to Slicer’s Python environment using remote Python debugging from VS Code, PyCharm, etc. as described here: