Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Import my classe?

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 280 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 18/04/2017 at 01:17, xxxxxxxx wrote:

      How can I import my classes? The documentation says that the class should be registered as a plug-in. And how do I call it in the function body? How to name a class? And in which file to store the class (py or pyp)?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 18/04/2017 at 02:38, xxxxxxxx wrote:

        Hi,

        It seems there's some confusion here.
        Plugin data classes are loaded and registered automatically by Cinema.
        Custom/user/utility classes can be defined in py files and imported inside other py or pyp files.

        The best solution is to organize the imported files/modules in subfolder(s).
        You can find interesting threads on Stack Overflow. For instance:
        Python: import a file from a subdirectory

        python - Import module from subfolder_<_h3_>_

        It is strongly advised to not mess up with sys.path or   PYTHONPATH.

        Be aware Python can't import pyp files.

        EDIT: Updated Python: import a file from a subdirectory link

        1 Reply Last reply Reply Quote 0
        • First post
          Last post