Retrieving Pipe Types from the Revit API

Hello, I am writing python code to be able to utilize the PI command for drawing a pipe. Right now I have successfully made code that can allow the user to select a pipe type for a plumbing system. Example : Select Pipe Type: (Pipe Type 1, 2, etc.) once the user selects from this pop up window the PI command begins. How can I now make it so that before the PI command is initiated, the pipe type is chosen in the properties so the type will match after drawn?

You wouldn’t be able to modify it during the command anyway. Instead, just draw the pipe and then change the pipe type after the elements are created.

Can it automatically select the drawn pipe and make the change using python code?

Sure. You just need to keep track of the elements created or filter for new ElementIds after your command and select those.