Set the layers style programmatically using QGIS

for layer in iface.mapCanvas().layers():
    layer.loadNamedStyle('path/to/qml/file')

Or if this won't work, try:

for layer in QgsMapLayerRegistry.instance().mapLayers().values():
    layer.loadNamedStyle('path/to/qml/file')

Not directly python solution, but there is a plugin called MultiQml that is exactly doing what you are looking for. After installing you find the plugin in menu Plugins --> MultiQml --> MultiQml. In plugin window select layers, click on Apply style ... button and search for your .qml file.

enter image description here