Module executable file

It is possible you are trying to access it too early. Maybe do some of the setup in the module widget’s setup function. Or connect a slot to the startupCompleted signal and do it there. To connect:

slicer.app.connect("startupCompleted()", self.onStartupCompleted)