Import my classe?



  • 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)?



  • 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


Log in to reply