Function named 'morePhotos' couldn't be found in the curre
Hello,How does Plex "resolve" its Callback functions?
I want to implement parts of my Instagram plugin logic in a different module "InstaStream.py". That source file is located in the same location as my __init__.py source file.
In **InstaStream.py** I have:
<br />
def readStream(title, url):<br />
oc = ObjectContainer(title2 = title, view_group = 'Pictures')<br />
...<br />
oc.add(DirectoryObject(key = Callback(morePhotos, url=nextUrl, title=title), title = 'Next...'))<br />
return oc<br />
In that same file I have the Callback:
<br />
def morePhotos(title, url):<br />
return readStream(title = title, url = url)<br />
However when I run that code my callback is not called and I get in the plugin Log:
**"Function named 'morePhotos' couldn't be found in the current environment"**
When I place the callback morePhotos **into my __init__.py** file, **then it works** (and by changing the function call to "return InstaStream.readStream(...)").
Now this introduces a mutual dependency on these modules. I can live with that, but want to understand what's going on and whether I'm doing something wrong here (mind you, I'm still new to Plex Plugin development as well as Python).
Off course I could also place everything into __init__.py - but you know, old programmer's habbit of structuring my code ;)
So how does this "Callback" (aka "Function" in pre-V2 Plugin API) work? I read somewhere in this forum that Plex imposes some restrictions onto "external Python modules". Is this one of them? Or does Plex simply assume that the "Callback" has to be implemented in __init__.py? Or am I simply not understanding the concept of "function callbacks" in Python? (Currently I have "function pointers" in mind, which probably won't help much here ;))
Thanks, Oliver