From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-28-2018 03:24 PM
I'm working on porting a large code-base from LabVIEW 2012 and the OpenG LabPython toolkit to LabVIEW 2018 and the native Python Node. One issue I've hit is how to preserve state on the Python side between calls to the Python Node? I naively assumed that it would work like the LabPython toolkit did - each session refnum was an instance of the interpreter and once objects were created in the interpreter they hung around until the refnum was closed - but it seems that I'm mistaken!
Is there a way to instantiate a Python object of soem sort in one function call and then get at it in a subsequent call without the overhead of passing things between Python and LabVIEW on every call?
07-04-2018 08:31 AM
Hi Gavin,
My name is Ashley and I am an Applications Engineer at National Instruments.
From what I understand you are able to achieve this with the LabPython toolkit. Are you able to provide an example of this?
It would be useful to see what you are trying to do using the new 2018 Python integration nodes.
From what I have seen, this isn't possible with the native LabVIEW python nodes - on each call to the python code you need to define all of the inputs.
Thanks,
Ash
10-02-2018 07:41 AM
I have the same question... I would like to write a python module to connect to a database. Ideally the module would contain several functions like: OpenDatabase(), ReadFromDatabase() and CloseDatabase(). For this to work, the python module would need to persist its connection to the database between calls from LabVIEW. It seems this was possible in the LabPython toolkit, but I can't see a way to do it using Python nodes in LabVIEW2018.
Thanks in advance.
01-30-2019 04:09 AM
@hollowhorse wrote:
I have the same question... I would like to write a python module to connect to a database. Ideally the module would contain several functions like: OpenDatabase(), ReadFromDatabase() and CloseDatabase(). For this to work, the python module would need to persist its connection to the database between calls from LabVIEW. It seems this was possible in the LabPython toolkit, but I can't see a way to do it using Python nodes in LabVIEW2018.
Thanks in advance.
+ 1
Any new developments on this?
Was just the searching for the same thing: how to preserve Python node state between calls.
This would be usefull for using Python as a means to connect to databases or equipment which require an Open and Close method.
03-05-2019 09:14 AM
+1
Intended to create a LV DLL passing the Python session between the functions as a global variable to save overhead introduced by running an Init and shutdown at the beginning and end of each function, but this seems impossible.
03-05-2019 09:26 AM
Hi all,
Please post in the LabVIEW Idea Exchange if you would like this functionality to be added:
https://forums.ni.com/t5/LabVIEW-Idea-Exchange/idb-p/labviewideas
This will help bring this to the attention of R&D.
Thanks,
Ash