2
$\begingroup$

I'm trying to follow the scripts from the book The Blender Python API by Chris Conlan, and I've been unable to import modules in Python from Blender (2.81) on osx 10.15.2. What file structure / linking is needed to import modules in Blender 2.8?

The closest question I've seen here is Error: No module named ' .... ', which seems to be close, but the single answer there doesn't work for me. (I don't currently have enough reputation to comment over on that question.)

Specifically, I'm trying to run this example from the code given in the book. The problem is that I don't know how the file ut.py should be handled. Where should it be placed? Does it need to be linked into the blender file somehow?

I've so far been unable to set up a minimal example to get anything to import from another module source file, either using the code from the book or with a minimal example like this. The source code from the book needs minimal refactoring to work with 2.8, but otherwise seems functional.

$\endgroup$
4

1 Answer 1

2
$\begingroup$

For me the answer was to put the entire project into a folder with the proper structure and set this as the scripts path in preferences.

enter image description here

This is the folder structure I used, and I was able to run the example scripts from the book:

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .