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:
layers[0].parent=font.glyphs[“a”]

creates pretty strange things…

Use replaceActiveLayersWithGlyphs_ on Edit View, like so:

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

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.