After searching the web, I found that it is not currently possible to gain full IDE code-completion/analysis for Slicer python development as some packages are added at run-time.
I was able to gain some package importation analysis (resulting in the removal of many false errors and warnings) by the following:
- In PyCharm open your Slicer project of choice
- In the menu-bar, open File > Settings
- In Settings, click Project: ____ > Project Interpreter
- Next to Project Interpreter click > Add
- Navigate to and select Slicer installation directory \ bin \ PythonSlicer.exe
The following should appear:
PyCharm will now interpret using Slicer’s included python binary. I would not recommend updating or adding packages. However, I did find it useful to add the Python 2.7 PyQt package as a reference module, as it offers full PyQt code-completion. Remembering to remove this manually added package and point to Slicer’s PyQt (import qt) before deployment.