# 3rd party Python modules

**URL:** <https://forums.plex.tv/t/3rd-party-python-modules/21509>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [September 17, 2012, 8:27pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509 "2012-09-17T20:27:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maik](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@maik](https://forums.plex.tv/u/maik)\
**Post date:** [September 17, 2012, 8:27pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509/1 "2012-09-17T20:27:56Z")

</div>

I’m writing my first plugin here which needs to use some 3rd party Python modules. What is the preferred method for getting these modules on the end-user’s system? I’ve tried placing the relevant files in Contents/Code/ with **init**.py, but when PMS tries to load my plugin it errors when it tries to import the module in the same directory. I’m probably missing something obvious but couldn’t craft a search query that gave me anything relevant.  
  
  
  
Edit: Sorry, the error being “ImportError: No module named mymodule.class” from the line: from mymodule.class import Class

---

<div class="post-metadata">

**Author:** ![maik](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@maik](https://forums.plex.tv/u/maik)\
**Post date:** [September 17, 2012, 8:42pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509/2 "2012-09-17T20:42:21Z")

</div>

> [@](#):
>
> I'm writing my first plugin here which needs to use some 3rd party Python modules. What is the preferred method for getting these modules on the end-user's system? I've tried placing the relevant files in Contents/Code/ with \_\_init\_\_.py, but when PMS tries to load my plugin it errors when it tries to import the module in the same directory. I'm probably missing something obvious but couldn't craft a search query that gave me anything relevant.  
>   
> Edit: Sorry, the error being "ImportError: No module named mymodule.class" from the line: from mymodule.class import Class

  
Well... I dug some more and saw a few mentions of Contents/Libraries/Shared/. I dumped the 3rd party ones into there and it appears to being trying to load them now which is cool. PMS is complaining about a syntax error in one of them now... not sure what that's about.

---

<div class="post-metadata">

**Author:** ![maik](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@maik](https://forums.plex.tv/u/maik)\
**Post date:** [September 17, 2012, 8:56pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509/3 "2012-09-17T20:56:20Z")

</div>

> [@](#):
>
> Well... I dug some more and saw a few mentions of Contents/Libraries/Shared/. I dumped the 3rd party ones into there and it appears to being trying to load them now which is cool. PMS is complaining about a syntax error in one of them now... not sure what that's about.

  
Heh, more info. Turns out I just needed to search a little harder. The syntax error problem stems from the fact that OS X PMS uses Python2.5. Time to find more shared modules! :)

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [September 17, 2012, 10:31pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509/4 "2012-09-17T22:31:20Z")

</div>

The way to include 3rd party modules is to add them to the plugin bundle in a separate directory as:

```auto

<br />
Plugin.bundle/Contents/Libraries/Shared/<your module><br />

```

  
  
  
You'll also need to use the "Elevated" plugin code policy in order for the framework to allow loading a Shared Library. You set that flag in the plugin's Info.plist like so:  

```auto

<br />
<key>PlexPluginCodePolicy</key><br />
<string>Elevated</string><br />

```

  
  
-Edit-  
Heh, looks like I'm too slow.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 10:15pm UTC](https://forums.plex.tv/t/3rd-party-python-modules/21509/5 "2019-12-20T22:15:58Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
