I am trying to create a QGIS custom standalone application. I want to add the Google Physical map from OpenLayers plugin to my application when it starts, but I cannot seem to be able to access qgis.utils. These are my imports:
import qgis.core
import qgis.gui
import qgis.utils
import PyQt4.QtCore
import PyQt4.QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *
from qgis.utils import *
import sys
import os
But when I try to print qgis.utils.plugins I get an empty dictionary; {}
In the Python console in QGIS, this code does what I want, I just can't seem to get it working in my custom app;
olplugin = qgis.utils.plugins['openlayers_plugin']
ol_gphyslayertype = olplugin._olLayerTypeRegistry.getById(0)
olplugin.addLayer(ol_gphyslayertype)