On this page:
gui-available?
gui-dynamic-require

4 Dynamic Loading

The racket/gui/dynamic library provides functions for dynamically accessing the Racket GUI toolbox, instead of directly requiring racket/gui or racket/gui/base.

Returns #t if dynamic access to the GUI bindings are available – that is, that the program is being run as a GRacket-based application, as opposed to a pure Racket-based application, and that GUI modules are attached to the namespace in which racket/gui/dynamic was instantiated.

This predicate can be used in code that optionally uses GUI elements when they are available.

(gui-dynamic-require sym)  any
  sym : symbol?
Like dynamic-require, but specifically to access exports of racket/gui/base.