If you want to call the python script without a gui just execute it with python3
A growing (not complete) documentation on how to work with NGSolve in Python can be found in the documentation section
ngsolve.org/docu/latest/
I think for you the Netgen tutorials at the bottom are of interest. There you can see how you can define the geometries in Python as well instead of a geo file (this is especially helpful if you want to create more complex geometries - you have the Python functionality then for that).
The problem with the mesh size can be caused by a too coarse surface mesh. You could either try a finer surface mesh or manipulate the "grading" meshing parameter.
If you want to create surface meshes only, there is no need to remove the volume elements manually. You can set the meshingparameter perfstepsend to meshing.MeshingStep.MESHSURFACE, i.e. when you have a CSGeometry as described here
ngsolve.org/docu/latest/netgen_tutorials...e_3d_geometries.html
you can do
Code:
geo.GenerateMesh(maxh=0.3,perfstepsend=meshing.MeshingStep.MESHSURFACE)
to generate a surface mesh only.
Best
Christopher