I’m trying to delay a function that spits out text strings over UDP, but putting it in quotes and using the run() method isn’t giving me any results. in one instance I have the following"
If you are passing a string you need to put it in double quotes and another set of single quotes. Right now you are passing a local variable name to the function which is in a different scope.
ProgramScene is working fine, and whether or not the functions spit out the strings, I’m not getting any errors. ProgramScene is part of an extension called Scene. StoreScene is part of an extension called PyMaha, which is imported into Scene as pym; StoreScene and RecallScene methods are called at the end of ProgramScene. Here’s what it all looks like in its class without trying to introduce delay:
def ProgramScene(self, scene_number , compiledScene ):
self.no = scene_number
self.tup = compiledScene
self.name = self.tup[0]
self.dcaList = self.tup[1]
self.chanList = self.tup[2]
for dca in self.dcaList:
# get dca number from self.num
# get dcas index to use to look up assignments
# in chanList
self.num = dca[-1]
self.index = self.dcaList.index(dca)
self.chans = self.chanList[self.index]
for chan in self.chans:
pym.AssignDCA( self.num , chan )
pym.SetChanOn( chan , on = "1" )
pym.StoreScene(self.no , self.name)
pym.RecallScene(str(1))
The two methods at the end are what I’d actually like to delay.
When you say imported PyMaha as pym, are you creating a new instance of the class? I’ve always gotten a name error when trying to use a run command like that.
If it’s an extension you could just do something like ext.PyMaha.RecallScene() so the run function will be able to find it.