I remember fixing some bugs in kicad related to selection from python in v7. Make sure to update your kicad and do your changes from plugin, not a script, there is special logic synchronizing internal selection state that runs after the plugin completes, it is necessary to have the selection show up correctly in pcb editor.