PYTHONPATH not appended to sys.path in Cinema 4D 24


We've been using Cinema 4D R20 and R21 for some years and now we're preparing to migrate to the S24.

During these years, we've developed some Python Packages that are imported by our Python plugins.

In C4D 20 and 21 these modules have always been imported by the plugin with no errors.

In C4D 24, however, the same operation raises a "ModuleNotFoundError: No module named ..."

The paths to our packages are appended to PYTHONPATH environment variable before launching C4D.

Once C4D is launched, I've checked the PYTHONPATH in the Extension > Console > Python and the packages' paths are all there.

The sys.path however doesn't contain the Packages Path, as if the $PYTHONPATH were not inserted into the sys.path upon launching C4D.

Do you know if this is a known issue and if there's a "workaround" for importing external python packages in our C4D plugins (any workaround besides looping through the PYTHONPATH paths and appending them to the sys.path)?

These tests were executed from Cinema S24.111 on Windows 10 Enterprise.

Thanks for your help,
Ps.: This issue seems to be related to the issue described in However, as the latter is focused on other versions of C4D and as it was marked as "solved", I've preferred to create a new topic.

Hello @rodrigo,

Thank you for reaching out to us. With S24 you must setup an environment variable called C4DPYTHONPATH39 to achieve an effect similar to PYTHONPATH:


S24 will then be able to import modules and packages from that path.



Ok, I didn't know we could/should set this environment variable in C4D 24.
Thanks Ferdinand for your help!