Script: Change current selected glyhs in edit view

How can I change the current selected glyphs in edit view?

doc = Glyphs.currentDocument
layers = doc.selectedLayers()

if layers.count()==1:

creates pretty strange things…

Use replaceActiveLayersWithGlyphs_ on Edit View, like so:

editView = Font.parent.windowController().graphicView()
glyph = Font.glyphs['comma']

Don’t every set the parent on a layer (only if you really know what you are doing).
The layer is part of the glyph and the parent property is there so that the layer can access the glyph or the font.