diff --git a/tardis/__init__.py b/tardis/__init__.py index 14980a8dfed..5d2ec94e90b 100644 --- a/tardis/__init__.py +++ b/tardis/__init__.py @@ -12,13 +12,20 @@ # ---------------------------------------------------------------------------- import sys +import warnings # ---------------------------------------------------------------------------- -from astropy import physical_constants, astronomical_constants +if ("astropy.units" in sys.modules) or ("astropy.constants" in sys.modules): + warnings.warn( + "Astropy is already imported externally. Astropy should be imported" + " after TARDIS." + ) +else: + from astropy import physical_constants, astronomical_constants -physical_constants.set("codata2014") -astronomical_constants.set("iau2012") + physical_constants.set("codata2014") + astronomical_constants.set("iau2012") # ----------------------------------------------------------------------------