Exhibit (n)(2)

Consent of Independent Registered Public Accounting Firm

We consent to the incorporation by reference in this Registration Statement on Form N-2 and related Prospectus of PennantPark Investment Corporation (the Company) of our reports dated November 24, 2025, relating to the consolidated financial statements of PennantPark Investment Corporation and Subsidiaries’ and the effectiveness the Company’s internal control over financial reporting (on which our report expresses an adverse opinion on the effectiveness of the Company’s internal controls over financial reporting because of a material weakness), appearing in the Annual Report on Form 10-K of the Company for the year ended September 30, 2025. We also consent to the use in such Registration Statement of our report dated September 16, 2026, relating to the senior securities table appearing elsewhere in such Registration Statement.

We also consent to the reference to our firm under the headings “Financial Highlights”, “Senior Securities” and “Independent Registered Public Accounting Firm” in such Prospectus.

/s/ RSM US LLP

New York, New York

September 16, 2026