Extension Interoperability

  • Here's my question of the moment: is it possible for robofont extensions to be aware of each other? Essentially I'm wondering if an extension could provide an API for other extensions to consume. I'm not necessarily looking for code examples, just wondering if any of the following are possible…

    1. Is it possible to generate a list of the installed extensions in a python script? I know that from within an installed extension I could probably traverse up the current path until I got the the extensions folder, and then search around for the installed extensions, but I assume that there's a native way of doing this.

    2. Is it possible to add an extension to the python path in order to allow other extensions to import its libraries?

    3. Is it possible to have an extension write to a global variable that is then accessible to other extensions? (I'm assuming no, but trying to cover my bases)

    4. Is it possible to register custom events? that could then be triggered from within another extension?

    The web developer in me thinks that it might be possible to run a web server out of an extension, and have that available send requests to, but I really think that's probably the worst solution I could come up with.

  • Haha, not the answer I was expecting. Next time I'll come up with more outlandish things to do.

    Sorry about missing the mogo.extensions thing. I guess I need to sit down with the docs and read everything over again to make sure I don't ask any more dumb questions.

    Getting the list of extensions should work well for what I'm working on now, but one of those other methods will be handy down the line. Really looking forward to custom events. :D

  • admin

    I suppose everything is possible :)

    1. use the the ExtensionBundle object to manage your extensions
    from mojo.extensions import  ExtensionBundle
    print ExtensionBundle.allExtensions()

    see: extension API

    1. to share variables/packages the best thing todo is to add the a root path with your packages to the python sys.path.

    an example install.py in an extension

    import sys
    import os

    this allows to import modules from an extension

    1. the python way of sharing global variables

    2. Registering custom events will be possible in the next version!
      never thought about it to allow third party app use the same notification center, but this could be indeed very handy...

    good luck