I figured out the problem.
It was unrelated to the code I posted. Heopfully this will be helpful to others that get a similar error.
My code was templated from the QGIS_-Code-Examples (2_basic_main_window)
I didn't change the myPluginsDir variable. Be sure that you change it because by default it will be wrong.