Not sure about connecting your plugin to the Python Console but you could just incorporate your script inside your plugin so that it can be executed from the interface. For example, if you have a push button with the objectName pushButton
, you could add the following to your plugin_name.py file:
def script():
# your_code
self.dockwidget.pushButton.clicked.connect(script)
Reload the plugin (you could use the exeptionally useful Plugin Reloader plugin) and when you click the push button, it will try and run the script.
As you created a script from the Python Console, you could receive errors about modules which have not been defined. In which case, you will need to import these at the top of your .py file.