diff --git a/gstlal-inspiral/python/p_astro_gstlal.py b/gstlal-inspiral/python/p_astro_gstlal.py
index 036ca4ee48e09646e0b1b89f5f9117e9696e7abd..c4fde91810fd48134991fc6bd201d6181b0ef8b4 100644
--- a/gstlal-inspiral/python/p_astro_gstlal.py
+++ b/gstlal-inspiral/python/p_astro_gstlal.py
@@ -323,6 +323,7 @@ def compute_p_astro(event_ln_likelihood_ratio,
 
     Example
     -------
+    >>> import json
     >>> p_astros = json.loads(compute_p_astro(files))
     >>> p_astros
     {'BNS': 0.999, 'BBH': 0.0, 'NSBH': 0.0, 'Terrestrial': 0.001}
@@ -385,6 +386,7 @@ def compute_p_astro_approx(snr, far, mass1, mass2, livetime, mean_values_dict):
 
     Example
     -------
+    >>> import json
     >>> p_astros = json.loads(compute_p_astro(files))
     >>> p_astros
     {'BNS': 0.999, 'BBH': 0.0, 'NSBH': 0.0, 'Terrestrial': 0.001}