Naive attempts fail: e.g.
from mypackage import SomeClass$
gives
javax.script.ScriptException: SyntaxError: no viable alternative at character '$' in at line number 1
This question is unrelated to java nested classes, which are easily importable in Jython.
Such a class is for example the scala.Predef$ class, which one can then access with Predef$.foobar.
How can I achieve this import?
解决方案
I found a solution using Java Reflection like this:
from java.lang import Class
person = Class.forName("full.path.to.Person$").getField("MODULE$").get(None)
It's not pretty but it works. It might be nicer to use the Scala reflection API if that's available.