Move the module code out of the main script