Would something like using pyperclip to copy the seed to the clipboard and then simulate a ctrl + v to paste be better than sending the keystrokes? Or same thing? Just some quick thoughts.
Provides a bit more secure layer than what OP has to offer but I guess the risk here is placing the seed phrase into the clipboard is globally accessible by other applications. Manipulating/Retrieving clipboard data is supported out of the box by a lot of RATs. Hence, no so secure!
To delete from memory, del selected_words and then call the garbage collector with gc.collect()?
I don't code in python, so I have limited knowledge about all of this.
I wouldn't trust the garbage collector to erase data. They are optimized to allocate/deallocate memory so you're not guaranteed it'll erase stuff immediately as requested. Besides that, won't your code just dereference the memory pointer and not actually delete the data? If this approach should be taken, one you'd be better off accessing the heaps from the operating system. (if hackers are inside your system then can easily access the memory dumps anyway so none of the above is actually secure realistically )