From 1231a520c01146ff24b0f3e2e619d5d22b7197e6 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Sun, 1 Feb 2026 23:24:40 +0100 Subject: [PATCH] Clarify the difference between ghidra and pyghidra imports I got confused by the distinction and the differences a few times, I figured it could be documented better. --- .../src/main/help/help/topics/PyGhidra/interpreter.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Ghidra/Features/PyGhidra/src/main/help/help/topics/PyGhidra/interpreter.html b/Ghidra/Features/PyGhidra/src/main/help/help/topics/PyGhidra/interpreter.html index 13ff477501..fdd5976545 100644 --- a/Ghidra/Features/PyGhidra/src/main/help/help/topics/PyGhidra/interpreter.html +++ b/Ghidra/Features/PyGhidra/src/main/help/help/topics/PyGhidra/interpreter.html @@ -25,6 +25,13 @@ them through a Python interface, which is similar to Java in some ways.

+

+ Note on imports: Since you are running inside Ghidra, you do not need to + import pyghidra or call pyghidra.start(). The pyghidra module is + only needed for standalone Python scripts running outside of Ghidra. Here, you can directly + import Ghidra API modules like from ghidra.program.flatapi import FlatProgramAPI. +

+

As in Java, classes outside of your current package/module need to be explicitly imported. For example, consider the following code snippet: