private void resetInterpreterInBackground() {

		//  Reset the interpreter by creating a new one. Clean up the old one if present.
		if (interpreter == null) {

			// Setup options
			ToolOptions options = tool.getOptions("Jython");
			includeBuiltins = options.getBoolean(INCLUDE_BUILTINS_LABEL, INCLUDE_BUILTINS_DEFAULT);
			options.registerOption(INCLUDE_BUILTINS_LABEL, INCLUDE_BUILTINS_DEFAULT, null,
				INCLUDE_BUILTINS_DESCRIPTION);
			options.addOptionsChangeListener(this);

			interpreter = GhidraJythonInterpreter.get();

			// Setup code completion.  This currently has to be done after the interpreter
			// is created.  Otherwise an exception will occur.
			JythonCodeCompletionFactory.setupOptions(this, options);
		}
		else {
			inputThread.shutdown();
			inputThread = null;
			interpreter.cleanup();
			interpreter = GhidraJythonInterpreter.get();
		}

		// Reset the console.
		console.clear();
		console.setPrompt(interpreter.getPrimaryPrompt());

		// Tie the interpreter's input/output to the plugin's console.
		interpreter.setIn(console.getStdin());
		interpreter.setOut(console.getStdOut());
		interpreter.setErr(console.getStdErr());

		// Print a welcome message.
		welcome();

		// Setup the JythonScript describing the state of the interactive prompt.
		// This allows things like currentProgram and currentAddress to dynamically reflect
		// what's happening in the listing.  Injecting the script hierarchy early here allows
		// code completion to work before commands are entered.
		interactiveScript = new JythonScript();
		interactiveScript.set(
			new GhidraState(tool, tool.getProject(), getCurrentProgram(), getProgramLocation(),
				getProgramSelection(), getProgramHighlight()),
			new ScriptControls(console, interactiveTaskMonitor));
		interpreter.injectScriptHierarchy(interactiveScript);
		interactiveTaskMonitor = new JythonInteractiveTaskMonitor(console.getStdOut());

		// Start the input thread that receives jython commands to execute.
		inputThread = new JythonPluginInputThread(this);
		inputThread.start();
	}
Resets the interpreter to a new starting state.  This is used when the plugin is first
initialized, as well as when an existing interpreter receives a Jython exit command.
We used to try to reset the same interpreter, but it was really hard to do that correctly
so we now just create a brand new one.
<p>
NOTE: Loading Jython for the first time can be quite slow the first time, so we do this
when the user wants to first interact with the interpreter (rather than when the plugin loads).
Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonPlugin.java