diff --git a/pyfilemail/__main__.py b/pyfilemail/__main__.py
index <HASH>..<HASH> 100755
--- a/pyfilemail/__main__.py
+++ b/pyfilemail/__main__.py
@@ -155,7 +155,7 @@ https://github.com/apetrynet/pyfilemail',
     return args
 
 
-if __name__ == '__main__':
+def main():
     args = parse_args()
 
     pwd = None
@@ -191,3 +191,6 @@ if __name__ == '__main__':
     if res.status_code == 200:
         msg = 'Transfer complete!'
         logger.info(msg)
+
+if __name__ == '__main__':
+    main()
\ No newline at end of file
put all logic in a main function as attempt to get console_scripts in setup.py to work