How do I create a 'run once' Python node?

I would like to create a node similar to the File Path node, where it needs to be run once when placed, but produces the same value whenever the graph is run, without needing to run the node again. Is there a way to do this with a Python script?

Every node in Dynamo will only run once on initialization, unless an input has changed. If you want to remember results between nodes you’ll have to work with defined inputs (ie: type the value of a string in a string node and it’s stored in the graph). What type of data are you working with?

Hi Jacob. I have created a node that will read tables from many different types of database, and have set my graph to run manually. That node requires a connection string provided to it, but that string is pretty cryptic. I would like to create another node to call a .NET dialog to interactively create this connection string, but that only really needs to be run at the time it is placed. Very much like the File Path node, where you Browse to pick the file, but otherwise never need to touch again.

I am happiest working in Python, but can look at creating a .NET node as well.

Why not just use a string… once you find the value copy/paste and you’re done, right?

That’s what I am doing now - I have an external app to generate the string. I would like to publish this node, though, and want to make it easier for the user to work with.

So the string value varies per user? Some kinda password hashing I gather. Can you call the other application from a python node to get the string that way?

Yes I can. But I only want to call it when the node is placed - I don’t want the user to have to choose the table every time the graph is run.