Hi Sebastian - we have a 'protein' alias in our ASL language that does what you want. I would modify your code as follows to write only the protein structure:
from schrodinger.structutils import analyze ### New line
protein_atoms = analyze.evaluate_asl(st, 'protein') ### New line
protein = st.extract(protein_atoms, copy_props=True) ### New line
protein.write(name) ### Modified line
The 'protein' alias selects all atoms that are either part of a residue that has a Calpha carbon or are part of an ACE residue.
Dave