Following annotationScript.py script works fine in python.But when I try to execute it from java like below I am getting an exception like this,

Exception in thread "main" Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('Lexical error at line 11, column 1.  Encountered: "@" (64), after : ""', ('/home/heshan/workspace/IdeaProjects/PYtest/src/pythonScripts/annotationScript.py', 11, 1, '@annotate("double", "f", a="double")'))

      Can anyone explain why is this happening here and suggest a way to overcome this

#annotationScript.py script
def annotate(returns, operationName, **params):
    def decorate(func):
        params['returns'] = returns
        params['operationName'] = operationName
        func.__annotations__ = params
        return func
    return decorate

@annotate("double", "f", a="double")
def f(a):
    return a

@annotate("int", "add", var1="integer", var2="integer")
def add(var1,var2):
    return var1+var2

@annotate("double", "deduct", var1="integer", var2="integer")
def deduct(var1,var2):
    return var1-var2

class MyClass:
    @annotate("double", "MyClass.multiply", var1="integer", var2="integer")
    def multiply(var1,var2):
        return var1*var2

##print f.__annotations__
## above line gives an output like this : {'a': 'double', 'returns': 'double', 'operationName': 'f'}

// My java code
        PythonInterpreter interp =
                new PythonInterpreter();
        interp.exec("import sys");
        interp.exec("print sys.path");

        String str1 = "/home/heshan/workspace/IdeaProjects/PYtest/src/pythonScripts/annotationScript.py";
        PyObject obj = interp.eval("f.__annotations__");
        System.out.println("obj returned : " + obj);

Heshan Suriyaarachchi