# How to access a package declared in Slicer extension from the python console?

**URL:** <https://discourse.slicer.org/t/how-to-access-a-package-declared-in-slicer-extension-from-the-python-console/29779>\
**Category:** Support\
**Tags:** python, extensions\
**Created:** [June 1, 2023, 5:53pm UTC](https://discourse.slicer.org/t/how-to-access-a-package-declared-in-slicer-extension-from-the-python-console/29779 "2023-06-01T17:53:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [June 1, 2023, 5:53pm UTC](https://discourse.slicer.org/t/how-to-access-a-package-declared-in-slicer-extension-from-the-python-console/29779/1 "2023-06-01T17:53:53Z")

</div>

I have a python package declared within the extension, and I can import it directly when accessing from the extension code. How can I import that extension in the Slicer python console?

I’ve done this before, I know it is possible, but I cannot find it in the hierarchies of `slicer.modules.*` etc.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 1, 2023, 7:25pm UTC](https://discourse.slicer.org/t/how-to-access-a-package-declared-in-slicer-extension-from-the-python-console/29779/2 "2023-06-01T19:25:53Z")

</div>

Do you mean something like this?

```auto
self.showStatusMessage(' Importing lungmask AI ...')
try:
    import lungmask
except ModuleNotFoundError:
    self.showStatusMessage(' Installing lungmask AI ...')
    lungmaskPackage = "https://github.com/JoHof/lungmask/archive/master.zip"
    slicer.util.pip_install(lungmaskPackage)
    import lungmask

```

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [June 1, 2023, 8:05pm UTC](https://discourse.slicer.org/t/how-to-access-a-package-declared-in-slicer-extension-from-the-python-console/29779/3 "2023-06-01T20:05:48Z")

</div>

With the help of @DeepaKrishnaswamy I figured this out.

To be more specific, I wanted to import this package:

> <https://github.com/QIICR/TCIABrowser/blob/master/TCIABrowser/TCIABrowserLib/TCIAClient.py>

Which is part of this extension:

> **[GitHub - QIICR/TCIABrowser: 3D Slicer module for browsing and downloading...](https://github.com/QIICR/TCIABrowser)**
>
> 3D Slicer module for browsing and downloading medical imaging collections from The Cancer Imaging Archive (TCIA). - GitHub - QIICR/TCIABrowser: 3D Slicer module for browsing and downloading medical...

Which is very simple once you know how to do it. I hope I will remember it for the next time!

```python
from TCIABrowser import TCIAClient

```
