Making new libraries
-
Simple question: if I'm making a library, where do I put it if I want to import it into sketches I'm making in DrawBot?
-
You can either put a module script in the same directory as the main script, you need to use a relative
from . import myModule
or 'install' it in the python3 site-packages so you can do
import myModule
-
The
from . import mymodule
notation is only for relative imports within packages.The easiest way is indeed to put your module in the same folder as the main script. But just write
import mymodule
orfrom mymodule import nameinmymodule
.Note that imports ae cached: if you change your module, the main script won't see those changes until you reload your module (or restart DrawBot).
-
Alternatively you can park your module in
/Library/Python/3.6/site-packages/
(If using Py 3.6.) If that folder doesn't exist, you can create it manually. DrawBot will find it.
-
@frederik @justvanrossum Thanks!