07-17-2013 06:38 PM
Hi,
I have a question about LabPython. Suppose I am given a Python script that contains class definitions. I want to use LabPython to initialize such objects and manipulate them. Is there a way of achieving object persistence with LabPython?
Here was my idea:
I could create a wrapper Python script around the script with the class definitions.
Let's say my class definition script code/pseudocode looks like this:
class d
bark_volume = 0
def bark(self)
self.bark_volume = self.bark_volume+1
Now my wrapper could like this:
i = 0;
if(i == 0)
import stuff
if(i == 1)
a = dog
if(i==2)
bark_volume(a)
By changing the input variable i, I can import stuff, initialize an object of type dog, and then call methods on that class. By changing the variable i and making successive calls to the wrapper script from LabPython, I might be able to manipulate the object of type dog from the LabVIEW environment. Does this make any sense?
Thanks,
Carlo
07-18-2013 01:27 PM
Sounds like it should work. I would try it using the Script Node and see if it works. If you run into issues then I would suggest posting your code so that other users to help troubleshoot the issue.
07-18-2013 02:02 PM