diff --git a/rllib/rollout.py b/rllib/rollout.py
index <HASH>..<HASH> 100755
--- a/rllib/rollout.py
+++ b/rllib/rollout.py
@@ -506,7 +506,7 @@ def rollout(agent,
             episodes += 1
 
 
-if __name__ == "__main__":
+def main():
     parser = create_parser()
     args = parser.parse_args()
 
@@ -522,3 +522,7 @@ if __name__ == "__main__":
             "--out as well!")
 
     run(args, parser)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/rllib/train.py b/rllib/train.py
index <HASH>..<HASH> 100755
--- a/rllib/train.py
+++ b/rllib/train.py
@@ -257,7 +257,11 @@ def run(args, parser):
     ray.shutdown()
 
 
-if __name__ == "__main__":
+def main():
     parser = create_parser()
     args = parser.parse_args()
     run(args, parser)
+
+
+if __name__ == "__main__":
+    main()
[RLlib] Refactor `if __name__ == "__main__"` into `main()` method in rollout/train.py for better reusability (#<I>)