How to use classes of pythonPlugin? always compile failed, say can't find package


I create a gradle plugin project, by the document way(。Then I add the python's depend:


But it report an error:

Cannot resolve plugin 'com.intellij.modules.python' in dependencies (Reference: Plugin Dependencies)

I find a way to resolve it:
But when I build the project (use intellj.buildPlugin), it reported an error: 

错误: 程序包com.jetbrains.python.psi不存在 (Error: Package com.jetbrains.python.psi does not exist)

import com.jetbrains.python.psi.PyFunction;

How can I fix the error ? I want to use the Python PSI in my Plugin.
Thanks for your answer !


You must set/add Python dependencies as described here first:


Hi Yann Cebron,

Thanks for your help. I have followed the steps to set it up, but still fail. This is my "build.gradle" and "plugin.xml":

Is there anything wrong?


plugins {
id 'org.jetbrains.intellij' version '1.4.0'
id 'java'

group 'com.sannmizu.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 11

repositories {

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'

// See
intellij {
version = '2021.3.2'
type = 'PC'
downloadSources = false
sandboxDir = 'D:\\Project\\Sandbox'

patchPluginXml {
changeNotes = """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""

test {


<name>Step Tc Tp</name>
<vendor email="">Sannmizu</vendor>

.tc .tp文件的简单转到插件,能够点击函数直接跳转,提供了函数名补全,路径补全

<!-- please see
on how to target different products -->

<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<fileType name="TestPoint" implementationClass="com.sannmizu.example.step.TestPointFileType" fieldName="INSTANCE" language="TestPoint" extensions="tp"/>
<fileType name="TestCase" implementationClass="com.sannmizu.example.step.TestCaseFileType" fieldName="INSTANCE" language="TestCase" extensions="tc"/>
<psi.referenceContributor implementation="com.sannmizu.example.step.TestCaseReferenceContributor"/>

<!-- Add your actions here -->

I find that add the dependency to the "PythonCore" can resovle it: 

Dose this complict with the description "No specific declaration is needed to use PY or PC APIs." ?


Please sign in to leave a comment.