SOLVED Execute a Python Code Within PyCharm that Connects to C4D?


Is it possible to run/execute Python code within Pycharm and the lines get processed immediately in C4D?

(1) I edit the python file in Pycharm.
(2) Open the python file within C4D's Script Manager
(3) Then Execute.

And if you make changes in python file, C4D prompts you every time to save the changes which is slightly cumbersome.

Basically, I would just like to reduce it to one step
(1) Edit and run/execute the python file within Pycharm

Basically, I'm looking for something like MayaCharm ( equivalent for C4D?

Thank you for looking at my problem


Thanks for the response, but correct me if I'm wrong but that documentation is for autocompletion.
I already have a set-up a like that, but it does not connect with C4D.

For instance,
If I run a print ("Hello World"), it appears okay in Pycharm but no reaction in C4D application itself. The c4dpy.exe and the cinema4d.exe are in the same version.

For comparison, with the Maya Pycharm, if I run a print ("Hello World"), the phrase appears in the console in Maya.

Is thre a way around this?

If you run c4dpy from PyCharm, any code that can be run in Cinema 4D is executed. You can see it in the Terminal.
It depends on how you invoke your script when running Cinema 4D in normal mode.
You may want to consider this thread:
and also read about the initialization of scripts at startup:

Thanks for the response @mp5gosu. But the init file is not really what I am looking for. Correct me if I'm wrong its the set-up to run scripts at start-up.

Anyway, you can see the problem in this illustration video:

If C4D and Pycharm is connected, the Hello World should be present both in PyCharm and C4D

Oh hey, now I understand you. 🙂
You get indeed a reaction from c4dpy, it is written in you PyCharm console, namely Hello World.
But here seems to be a misunderstanding.
c4dpy is an interpreter, it does not run nor interact with your Cinema 4D installation. c4dpy is a so to say "standalone python interpreter" with access to Cineama 4D's api.

You can load documents, modify and save them - all without having to open Cinema 4D.
you can use Cinema 4D's script manager to write your scripts (the video shows that you already did that.
Another option would be to have a command plugin. I'm usually writing my plugins in PyCharm and use a build configuration that designates Cinema as external tool. This way, I have a gui environment and debugging tools avilable.

Hope, this helps a bit. Maybe some of the devs will be of more help here.
edit: But from what I can tell, it's not so easily possible to achieve the same live link like MayaCharm offers.

You need something like this solution for Sublime Text
Maybe you can adapt that code, fork repo and create what you need for PyCharm.

@mikeudin That would require him to write an own listener plugin. I believe, that is way out of scope.

Thanks for the confirmation that it's not yet available. This will help me be in peace that I am at a dead end at the moment 🙂


Thanks for the reference! But I am afraid, that is beyond my skillset. But will keep it in mind if Sublime will be supported in the future for the autocompletion.

Sorry for joining in so late. And I think, all relevant points have already brought up.
I just wanted to add one twist or slightly different point of view:

c4dpy is a so to say "standalone python interpreter" with access to Cineama 4D's api.

Actually c4dpy is a full headless Cinema 4D, which can be used as a Python interpreter in IDEs.



Thanks for the response. Am I correct to say that Sublime is not yet supported currently for autocompletion? It's not included in the c4dpy documentation. Correct me if I'm wrong. but it only includes PyCharm and Visual Studio.

@bentraje said in Execute a Python Code Within PyCharm that Connects to C4D?:

Am I correct to say that Sublime is not yet supported currently for autocompletion?

Well, there is a plug-in.
But it needs to be updated for Cinema 4D R20.

Probably mikeudin is right. I have never checked Sublime in this regard, though it's certainly a very nice editor. c4dpy itself can probably be used with other IDEs (like for example Ultra Edit Studio) as well, it's just that we only documented, what we tested here. But unfortunately we can only provide support for what we tested here, so with other IDEs you'd be either on your own or would need to rely on our forum community.


Thanks for the confirmation @a_block

Will hope for the best in the future regarding sublime

Have a great a day ahead!