Adding vtkPolyData as Source? [solved]

Hi there,
Wait seems like TrivialProducer is what I’m looking for
I’m just getting started with Paraview and was hoping to experiment with generating polydata programmatically to view in Paraview just to get some shapes to work with that I can mess around with. I stumbled on the Live Programmable Source and an article showing how to create things with it in the GUI (https://cvw.cac.cornell.edu/ParaViewAdv/progsource). I was wondering if there’s a way to write the following in the paraview python shell instead of Programmable Live Source and have a render of it appear in the View.

import paraview.vtk as vtk

points = vtk.vtkPoints()
points.InsertPoint(0, 0, 0, 0)
points.InsertPoint(1, 1, 0, 0)
points.InsertPoint(2, 0, 1, 0)
points.InsertPoint(3, 0, 0, 1)
pdo = vtk.vtkPolyData()
triangle = vtk.vtkPolygon()
triangle.GetPointIds().SetNumberOfIds(3)

tris = [[0,1,2], [0,2,3], [0,3,1], [1,3,2]]
for t in range(0, 4):
    for p in range(0, 3):
        triangle.GetPointIds().SetId(p, tris[t][p])
    pdo.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds())

I’ve tried to run Show() or Render() after all this but I suppose since I don’t have a source representing the polydata there’s no reason to believe those would have worked. Thanks for anyone who can suggest how I would make this pdo variable visible.

Like I mentioned in the top of the original post, it looks like I need the TrivialProducer but there’s a new issue that something in the script is causing a seg fault when it tries to insert the tris as cells. I might make a new issue out of this shortly, but I figure I should post here that the code above might be buggy.

When running from pvpython this seems to have worked for my purposes.

import paraview.vtk as vtk
from paraview.simple import *

points = vtk.vtkPoints()
points.InsertPoint(0, 0, 0, 0)
points.InsertPoint(1, 1, 0, 0)
points.InsertPoint(2, 0, 1, 0)
points.InsertPoint(3, 0, 0, 1)
pdo = vtk.vtkPolyData()
pdo.SetPoints(points)
pdo.Allocate(4, 4)

triangle = vtk.vtkPolygon()
triangle.GetPointIds().SetNumberOfIds(3)

tris = [[0,1,2], [0,2,3], [0,3,1], [1,3,2]]
for t in range(0, 4):
    for p in range(0, 3):
        triangle.GetPointIds().SetId(p, tris[t][p])
    pdo.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds())

tp = TrivialProducer()
tp = TrivialProducer()
tp.GetClientSideObject().SetOutput(pdo)
Show(tp)
Render()
Interact()