Can I create a plugin which uses already existing PyCharm project?

Answered

Hello,

 

so my situation is this: I already have a PyCharm project which does some kind of analysis for Android Studio projects, and uses downloaded open source tools which have to be called from Terminal. I have a main class script.py which uses several subprocess.Popen commands (basically executes commands in Terminal). So I actually have 2 questions:

1. Can you create a plugin for Android Studio which utilises that PyCharm project? For example with Jython acting as a glue between my plugin ToolWindow (commonly implemented with Java files) and the script.py class, which is called from ToolWindow. In that case PyCharm project would be a module I guess.

2. Is it at all possible to run Terminal commands from my ToolWindow which use some resources from my plugin? If number 1 is impossible, I could write something similar to script.py using Java, but then I have to execute commands through Terminal.

4 comments
Comment actions Permalink

Antonio,

I'm not sure if I got your point - you want to trigger the execution of another project from the active Android Studio passing the current project as an input? Should such plugin be provided to anyone or you want to run it just for yourself?

0
Comment actions Permalink

Sorry for not being clear. Yes, I basically want to run another project (PyCharm one) using active Android Studio project root as an input. In normal circumstances on my PC, I'd just call script.py from Terminal with target Android Studio project's root folder path as argument (something like "python3 script.py path_to_androidstudio_project_root"). script.py uses the resources from its PyCharm project. If it's possible, I'd like to make a plugin which takes project.getBasePath() and calls the mentioned script from terminal in the same way. So I need to find a way to bundle the PyCharm project so I can access it from within plugin. Is there any way to do this? Maybe put it in resources folder?

0
Comment actions Permalink

According to your requirement,s I think that installing Python plugin inside Android Studio and setting up the Run/Debug Configuration with the Python project specified would be enough to solve your automation problem.

0
Comment actions Permalink

Thank you, will try that

0

Please sign in to leave a comment.