KiCAD python script - how to use them?

I have never used scripting in KiCAD but now I want to do this. What I want to do is change drill size or change reference text width using script in multiple footprints. Could somebody tell me how to do this? I tried using script console but it does not work for me.

Thanks alot.

Can you provide a little bit more information?

What version of KiCad are you using?
What sort of system are you on?

What do you mean by “the script console does not work”? What does it do when you try to use it?

For example I want to use this script:

  from pcbnew import *
pcb = GetBoard()
moduleCount = 0
for aModule in pcb.GetModules():
    moduleCount = moduleCount + 1

I get this:

Traceback (most recent call last):
  File "<input>", line 2, in <module>
  File "E:\Program Files\KiCad\lib\python2.7\site-packages/", line 9311, in SetVisible
    return _pcbnew.TEXTE_MODULE_SetVisible(self, isVisible)
TypeError: in method 'TEXTE_MODULE_SetVisible', argument 2 of type 'bool'

I use windows 7, pcbnew (after 2015-mar-04)

I guess by now you’re on a more up-to-date KiCAD version from here which doesn’t give me this error?