.cir to Python classes

I am completely new to electronics and any kind of circuit modelling. I have a .cir file that I need to turn into python classes so I can carry out precedures like chaining 2 or more subcircuits together and doing monte carlo simulation. The .cir was exported from PSpice. I was wondering, is this possible? To turn .cir to python classes? .cir has subcircuits defined.

I found the .raw_spice feature helpful to convert “classical” spice Netlists to pyspice.
It is quite easy to add Python Variables and link to external routines.

One of my examples:

from PySpice.Spice.Netlist import Circuit

circuit = Circuit(‘Test’)

circuit.raw_spice = ‘’’
*.title rtest
.param rdc= ‘’’+str(rdc)+’’’
I1 1 r 0 AC 1
R1 r 0 {rdc}
‘’’

…further pyspice commands

You can try the cir2py command (provided with PySpice) to convert netlist to Python. But parser is not complete …