KeyShot Forum

Technical discussions => Extending KeyShot => Scripting => Topic started by: Morten Kristensen on November 13, 2015, 04:09:07 AM

Title: Read Me First
Post by: Morten Kristensen on November 13, 2015, 04:09:07 AM
Scripting, in the form of Python, is supported with
and  and all questions, tips and tricks will be contained in this board.
Feel free to ask and share your findings with scripting.

Don't send me private messages asking for help, please. Write a forum post about it.

If you want to share code more than 5-10 lines then please either upload the file as an attachment or post a link to the code instead (like https://gist.github.com (https://gist.github.com) or http://pastie.org (http://pastie.org)).

Common answers will be put here continually for easy access to ones new to scripting.

API documentation can be found here: https://media.keyshot.com/scripting/doc/9.0/index.html (https://media.keyshot.com/scripting/doc/9.0/index.html)
For a quick start to scripting go here: https://media.keyshot.com/scripting/doc/9.0/quickstart.html (https://media.keyshot.com/scripting/doc/9.0/quickstart.html)

To learn Python as a beginner go here: http://www.learnpython.org
Or for more depth: http://www.diveintopython3.net

Troubleshooting

Module not found
If you get an error similar to

ImportError: No module named 'X'

where you substitute "X" with the module name (it could be "bisect", for instance) then it might be something left out of the KeyShot distribution. A workaround for this is to enable KeyShot to use a locally installed Python's modules. Install Python 3.6 (https://www.python.org/downloads/release/python-364/) (must be 64-bit if you run 64-bit KeyShot and 32-bit otherwise) to C:\Python or C:\Python36 if on Windows. On Unix-like systems just install using your package manager. In both cases it will try to automatically detect the installation. Finally restart KeyShot and try the script again.