I agree with this comment. from dolfin import *
imports the mesh
module (dolfin.mesh), which is different from the self.mesh
class variable.
If you are new to fenics it is recommended to use DOLFINx, see The new DOLFINx solver is now recommended over DOLFIN