Python 在成员函数中访问脚本级函数

Python 在成员函数中访问脚本级函数,python,jython,Python,Jython,我有一个jython脚本,其中类中定义了一些成员函数。脚本中还定义了其他函数: import xxxx class SomeClass (Callable): def call(self): hello() def hello(): print 'hello' ldr_files = [] ldr_files.append(SomeClass()) thread_pool

我有一个jython脚本,其中类中定义了一些成员函数。脚本中还定义了其他函数:

    import xxxx
    class SomeClass  (Callable):
        def call(self):
            hello()

    def hello():
        print 'hello'        

    ldr_files = []
    ldr_files.append(SomeClass())
    thread_pool = Executors.newFixedThreadPool(8)
    results = thread_pool.invokeAll(ldr_files)
但是,这似乎与jython不一致,并且它不调用“hello()”函数


在调用hello()之前会调用一系列其他成员函数-成员函数调用等,这些调用工作正常。只有当控件移动到该调用时,它似乎没有调用函数(没有打印hello)。

问题在于实际代码中传递的参数。拼写错误!对于一个不愿向我展示它的编辑来说,这太多了


很抱歉浪费了你的时间。

你怎么称呼foo?另外,您的语法看起来不太正确,
classsomeclass
应该是
classsomeclass:
。谢谢@kennes913。编辑制作。SomeClass是一个虚拟表示。实际上,我有一个由threadpoolexecutor使用的callable。为了简单起见,我将它们表示为上面的形式。为了回答这个问题,调用foo()的方法是在脚本下面实例化某个类,然后在其上面调用该方法。像这样吗
class\u instance=SomeClass()
class\u instance.foo()
您是否还有另一个
hello
(或任何实际调用的)函数?也许您正在导入另一个。您是否像foo import*那样导入?