Switch doc order
# Python
+### In Python
+
+You can also launch the Gateway in your script using [`py4j.java_gateway.launch_gateway(...)`](https://www.py4j.org/py4j_java_gateway.html#py4j.java_gateway.launch_gateway). This does not require you to start the Java Gateway from the command line. You must specify `jarpath={path/to/robot.jar}` and `classpath=org.obolibrary.robot.PythonOperation` in the args, all other `launch_gateway` args are optional.
+
+```python
+import py4j
+from py4j.java_gateway import JavaGateway
+
+py4j.java_gateway.launch_gateway(jarpath='path/to/robot.jar',
+ classpath='org.obolibrary.robot.PythonOperation',
+ die_on_exit=True)
+
+gateway = JavaGateway()
+
+io_helper = gateway.jvm.org.obolibrary.robot.IOHelper()
+
+ont = io_helper.loadOntology('ontology.owl')
+```
+
+If you do not specify `die_on_exit=True` in the `launch_gateway` args, the JVM will continue running after the Python process has exited.
+
### On The Command Line
The `python` command enables access of ROBOT operations and objects in Python using [Py4J](https://www.py4j.org/). This command does not accept any input ontologies and does not produce any outputs. You *cannot* chain this command with other ROBOT commands.
@@ -31,24 +52,3 @@ Once finished, you can stop the gateway server from the command line with Ctrl+C
```
fg
```
\ No newline at end of file
-
-### In Python
-
-You can also launch the Gateway in your script using [`py4j.java_gateway.launch_gateway(...)`](https://www.py4j.org/py4j_java_gateway.html#py4j.java_gateway.launch_gateway). This does not require you to start the Java Gateway from the command line. You must specify `jarpath={path/to/robot.jar}` and `classpath=org.obolibrary.robot.PythonOperation` in the args, all other `launch_gateway` args are optional.
-
-```python
-import py4j
-from py4j.java_gateway import JavaGateway
-
-py4j.java_gateway.launch_gateway(jarpath='path/to/robot.jar',
- classpath='org.obolibrary.robot.PythonOperation',
- die_on_exit=True)
-
-gateway = JavaGateway()
-
-io_helper = gateway.jvm.org.obolibrary.robot.IOHelper()
-
-ont = io_helper.loadOntology('ontology.owl')
-```
-
-If you do not specify `die_on_exit=True` in the `launch_gateway` args, the JVM will continue running after the Python process has exited.
\ No newline at end of file
