Applying periodic boundary condition in FEniCSx

I am trying to implement periodic boundary conditions in fenicsx. I found a code shared by Dokken here for periodic boundary conditions in Poission 2D. But it was meant for dolfin and not dolfinx. So I have been trying to modify it to execute it using dolfinx. An image for the code is shared here.

Iam getting an error “name SubDomain is not defined”.

Please read Read before posting: How do I get my question answered? . Never post your code and your error as images: they are impossible to copy and paste, impossible to search, and sometimes difficult to even read (look at how small the font is in your first picture, and imagine I was reading this message from a cellphone)

Look at GitHub - jorgensd/dolfinx_mpc: Extension for dolfinx to handle multi-point constraints. for periodic BCs (and much more) in dolfinx.

Thanks a lot for the help. I will keep in mind your advice for future.