Can't obtain Element Properties/Parameters until a new Element is Created(2)

Hello All,
I accidentally deleted my last post, but here’s the content I didn’t loose:
I’ve found a curious issue where I can’t seem to get the Circuit Number of a newly created ElectricalSystem until after I’ve created a completely new and separate Electrical System. Here’s my process:

  1. Create System (with terminal elements)
  2. Select Panel
  3. Get Circuit Number
    ^ which doesn’t work unless I’ve done step #1 again or affected the model in a major way like copied elements around.
    I’m wondering if there’s come kind of dispose method I can use to release control over the Electrical System instead of having to create a new one just to get the Info I need.

My Dynamo File and RVT file are attached:

Sorry for the massive reference list… I like to add them by hand.

The elements within the model that the Dynamo routine modifies are located here:

All you have to do to replicate my results is run the Dynamo… Once you do, you will notice that the results of ElectricalSystem.CircuitNumber are incorrect for the last of the 3 circuits and should say “9” instead of “unnamed”:

The breakdown occurs within the user-defined function “CircuitElements” spanning from line 85 to line 95. You’ll notice that if you move the CircuitNumber getter to within this function, all 3 Circuit Number calls fail. The CircuitNumber getter is currently located on line 140, and the predefined functions in this node span until line 125.
Freemont AutoCircuiting(forDynamoBim.comTesting).dyn (8.5 KB)
Model File is apparently too Large, so I uploaded it here:

Thank You All Very Much for taking the time to help me with this issue.

Is all of this being done within Dynamo? You might try using Transaction.End after you’ve created the new ElectricalSystem and before you get the Circuit Number. Could be that Dynamo is trying to get the parameter value before it has created the element.

Yes, all of this is done within one Python node, and I didn’t use “Transaction.End,” but I did use “TransactionManager.Instance.TransactionTaskDone().” If there is a difference between these two, I wasn’t really aware of it.

Additionally, I can collect a few other parameters from the ElectricalSystem directly after creating it, although some (like Circuit Number) remain unavailable.

Looks like you have to create a user defined Transaction and commit it to the model.

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
from Autodesk.Revit.DB import Transaction
t = Transaction(doc, “ElectricalSystem Creation Transaction”)
*Create Circuits *
*Get Circuit Info *