ClassCastException

Hi everyone,

I’m trying to import a class from a separate file. I got ClassCast Exception message. Can anyone help me out? Thank you!

add_library('pdf')
from Sq import Sq
colorList=["#F5AD27","#D86D6D","#9CFCA1","#C3CBA0","#9CFCA1"]
squares = []
def setup():
    size(500,500)
    background(255)
    
    noStroke()
    beginRecord(PDF,"Output/test.pdf")
    squares.append(Sq(0,0,width))
    noLoop()
def draw():

    drawSquare(3)
    for squ in squares:
        squ.display()
    endRecord()
    
def drawSquare(res):
    tempSquares=[]
    
    
    if res > 1:
        for squ in squares:
            tempSquares.append(squ.x,squ.y,squ.s/2,res)
            tempSquares.append(squ.x+squ.s/2,squ.y,squ.s/2,res)
            tempSquares.append(squ.x,squ.y+squ.s/2,squ.s/2,res)
            tempSquares.append(squ.x+squ.s/2,squ.y+squ.s/2,squ.s/2,res)
        squares=tempSquares
        res-=1
        drawSquare(res)

separate file with class:

class Sq:
    def __init__(self,x,y,s):
        self.x=x
        self.y=y
        self.s=s
    def display(self):
        fill(colorList[int(random(len(colorList)))])
        square(self.x,self.y,self.s)

error message:
ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’)
at jycessing.LibraryImporter.addJarToClassLoader(LibraryImporter.java:315)
at jycessing.LibraryImporter.recursivelyAddJarsToClasspath(LibraryImporter.java:164)
at jycessing.LibraryImporter.addLibrary(LibraryImporter.java:140)
at jycessing.LibraryImporter$1.call(LibraryImporter.java:82)
at org.python.core.PyObject.call(PyObject.java:480)
at org.python.core.PyObject.call(PyObject.java:484)
at org.python.pycode._pyx163.f$0(recursions_square.pyde:1)
at org.python.pycode._pyx163.call_function(recursions_square.pyde)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.Py.exec(Py.java:1658)
at org.python.pycode._pyx162.f$0(/var/folders/4c/vx4wkqss45zb24tf5y56vbxw0000gn/T/recursions_square5125658006693551092/recursions_square.pyde:96)
at org.python.pycode._pyx162.call_function(/var/folders/4c/vx4wkqss45zb24tf5y56vbxw0000gn/T/recursions_square5125658006693551092/recursions_square.pyde)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.Py.exec(Py.java:1658)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)
at jycessing.PAppletJythonDriver.processSketch(PAppletJythonDriver.java:233)
at jycessing.PAppletJythonDriver.findSketchMethods(PAppletJythonDriver.java:613)
at jycessing.Runner.runSketchBlocking(Runner.java:399)
at jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:112)
at java.base/java.lang.Thread.run(Thread.java:833)