Is it OK to have private functions in a python toolbox?

I know it's possible because I tried. But I don't know if that's OK, I haven't seen anything in the Internet where someone from ESIR is using private functions.


class Toolbox():

class Tool():
  def ____clip_features____(self):
  # clip features

  def ____buffer_clipped_features____(self):
  # buffer

Basically I don't want to have all the code in Execute, I want to break it into functions.

  • 1
    "ESIR"? Do you mean Esri?
    – Vince
    Mar 27, 2016 at 19:10

1 Answer 1


Of course you can split your code out into functions. Don't bother with private methods, they aren't really private and they just make your code harder to read. Note that the convention for private methods is two underscores at the beginning of the variable name and none at the end.

However, you still need to have an execute method from which you call your other methods, otherwise ArcGIS won't be able to run the tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.