# Cached Code?

**URL:** <https://forums.plex.tv/t/cached-code/90330>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [January 17, 2015, 1:49am UTC](https://forums.plex.tv/t/cached-code/90330 "2015-01-17T01:49:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmonterroso](https://avatars.discourse-cdn.com/v4/letter/n/71c47a/32.png) [@nmonterroso](https://forums.plex.tv/u/nmonterroso)\
**Post date:** [January 17, 2015, 1:49am UTC](https://forums.plex.tv/t/cached-code/90330/1 "2015-01-17T01:49:09Z")

</div>

I'm trying to create a Plex Channel Plugin, but it seems like my code is being cached somewhere and always executed. Obviously, this makes it a pain to iterate. I've done simple things like change:

```
Log.Debug("This is an old message")
```

to

```
Log.Debug("this is a new message")
```

expecting that when I refresh the page I'll see my new log message, but I keep seeing the old log message show up in my log. Any help here is appreciated.

&nbsp;

---

<div class="post-metadata">

**Author:** ![elan](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/elan/32/5_2.png) [@elan](https://forums.plex.tv/u/elan)\
**Post date:** [January 17, 2015, 2:52am UTC](https://forums.plex.tv/t/cached-code/90330/2 "2015-01-17T02:52:37Z")

</div>

Channels / agents should be reloaded automatically when you change code (look at the log in PMS Plugins/... to see). Could it be the caching is on the client side?

---

<div class="post-metadata">

**Author:** ![Gerk](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/gerk/32/81980_2.png) [@Gerk](https://forums.plex.tv/u/Gerk)\
**Post date:** [January 18, 2015, 3:38pm UTC](https://forums.plex.tv/t/cached-code/90330/3 "2015-01-18T15:38:11Z")

</div>

Also of note is that PMS should reload the plugin when it detects a change in the filesystem. &nbsp;Depending on what you're using to edit your files I've seen this be quite hit and miss (dependant on OS as well, etc). &nbsp;For example when I use SFTP to edit a file on my dev server PMS doesn't always pick up a change and restart it. &nbsp;Sometimes I'll try adding an extra carriage return or two and saving again. &nbsp;If you watch the log files with something like Console.app on OSX you'll see when it reloads. &nbsp;Worst case if it doesn't reload you can manually stop and restart PMS (not ideal but sometimes you have to do what you have to do).

Also as elan said above, what client are you using to test with? &nbsp;If it's Plex/Web I would suggest using something different. &nbsp;Lots of potential for things to stay stuck in cache with Plex/Web. &nbsp;If this instance if you're watching log files and seeing the same lines from Log.Debug I don't think that's the issue here, but it might be the next one you run into ;)

---

<div class="post-metadata">

**Author:** ![czukowski](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/czukowski/32/9008_2.png) [@czukowski](https://forums.plex.tv/u/czukowski)\
**Post date:** [January 26, 2015, 8:32pm UTC](https://forums.plex.tv/t/cached-code/90330/4 "2015-01-26T20:32:58Z")

</div>

Just adding my two cents: in my experience Plex sometimes didn't recognize when I've made changes to some Shared Code (\*.pys) files, I had to restart the server. No idea what exactly caused those issues but it sure was frustrating. The Code/\_\_init\_\_.py and such haven't ever given me any trouble though.

---

<div class="post-metadata">

**Author:** ![Gerk](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/gerk/32/81980_2.png) [@Gerk](https://forums.plex.tv/u/Gerk)\
**Post date:** [January 26, 2015, 10:59pm UTC](https://forums.plex.tv/t/cached-code/90330/5 "2015-01-26T22:59:42Z")

</div>

The pys files I've seen before I think it's either expected behaviour and/or a known issue. &nbsp;You're meaning editing a Service file? &nbsp;I think that's the only place you should be using \*.pys files ...

---

<div class="post-metadata">

**Author:** ![czukowski](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/czukowski/32/9008_2.png) [@czukowski](https://forums.plex.tv/u/czukowski)\
**Post date:** [January 27, 2015, 5:46pm UTC](https://forums.plex.tv/t/cached-code/90330/6 "2015-01-27T17:46:32Z")

</div>

I meant those used like SharedCodeService.service\_name.do\_something() (example [here](https://bitbucket.org/czukowski/plex-svoeradio/src/10d2630f41a9936c9b0164f5e2285adf74df13ef/Shared%20Code/?at=master)). I recall that an almost sure way to reproduce was to leave a syntax error in a \*.pys file and make a call to that code, then it would stay there until PMS restart. If it's a known issue then not all hope is lost I guess :)

Not sure if the same happens for URL Services \*.pys files, mine are not very large, maybe I just haven't edited it enough to encounter the issue.

---

<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 21, 2019, 4:13am UTC](https://forums.plex.tv/t/cached-code/90330/7 "2019-12-21T04:13:29Z")

</div>

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