Either one of the footprints or any element needs to be removed and then undoed before these vias can be deleted using the Delete key
This needs a bit more context, and nobody will type the shown code character by character just to test it.
I might be wrong here, but IIRC the current Python API does not allow changing which items are selected. The [Set|Clear]Selected
methods is pcbnew’s internal C++ stuff. Hopefully the new API will be available soon.
Tom