true when running in the editor or a debug build, and returns
false in a release build.
Edit: Ignore the rest of this answer and look at Calinou's one.
You could also do something like:
# filename of your godot executable
var godot_exe = "Godot_v3.1.2-stable_win64.exe"
var path = OS.get_executable_path()
if godot_exe in path:
true in each exported build.
But your Godot's filename and the variable would need to be always equal.