Actually let me add that in jython I don't need to always use MyShell. It may be ok to wrapper it with some Jython class which then delegates to MyShell. So something like shell = MyJythonShell() shell.grep (grep_args) So MyJythonShell is defined in Jython which calls MyShell. Am wondering how to go about all this.