When to use a Transaction in Python

Hi,

I’ve started using Python within Dynamo and are gradually getting some good results, but I’m unsure when a Python script should use a Transaction.

My general understanding is that you use a Transaction when you create something in the Revit API - like a new wall, but I understand that all Python scripts in Dynamo are effectively a transaction which Dynamo creates.

I’d appreciate some advise on when to use one or when not to.

Thanks.

I would say that basically you should start a new transaction every time you are making any changes to the Revit DB. It’s true that Dynamo keeps a transaction open, but that is independent of what is happening inside of Python nodes. For the most part you should start a new one inside of Python for all changes to DB.