Sharing python variable between action groups

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
HA1
Posts: 71
Joined: Thu Mar 15, 2012 9:43 pm

Sharing python variable between action groups

Post by HA1 »

If I have two action groups each with an embedded python script, is there any simple way to share a python variable between them? The variable wouldn't change, it's just a list I want them both to have access to. If not, other way to share some list?
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Sharing python variable between action groups

Post by jay (support) »

Python has a built-in way to share scripts (and data in scripts) that is roughly parallel to AppleScript attachments. We discuss it in the Scripting Tutorial.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
HA1
Posts: 71
Joined: Thu Mar 15, 2012 9:43 pm

Re: Sharing python variable between action groups

Post by HA1 »

Thanks for the reply. The problem is, I keep getting the error: "embedded script: no module named indigoInclude"

I have a script in /Library/Python/2.5/site-packages
as well as /Library/Python/2.7/site-packages

I called it "indigoInclude.py" and I tried the name "indigoInclude" and no matter what I do it won't load and gives me this error. If I launch a standard python script from command line, it finds the file by doing "import indigoInclude" - any idea why Indigo's not finding it?
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Sharing python variable between action groups

Post by jay (support) »

When you add/remove something from the site-packages, much like when you add something to the Attachments folder, you need to tell Indigo that something changed. Select "Plugins->Reload Libraries and Attachments" and Indigo will restart both interpreters (thus causing the additions to become available).

BTW, the 2.5 directory is the right one - we use Python 2.5 for the IOM.

[EDIT] - I've updated the Scripting Tutorial with this information - it was an oversight that it wasn't there before.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
HA1
Posts: 71
Joined: Thu Mar 15, 2012 9:43 pm

Re: Sharing python variable between action groups

Post by HA1 »

Thanks, that worked!
Locked

Return to “Extending Indigo with Plugins and Python”