Can a script be run always in a file?

I made a graph that writes to a txt file data from a project. When dynamo is open this record each change to the file. It stops when dynamo is closed. Is there a way to make this run continuously in the back ground when dynamo is not open?

Did you try using windows task scheduler.

If think you should a look at the Revit Api and “Dynamic Model Update”. is a great place to start.