PySpice-org / PySpice

Simulate electronic circuit using Python and the Ngspice / Xyce simulators
https://pyspice.fabrice-salvaire.fr
GNU General Public License v3.0
641 stars 169 forks source link

Importing Circuit class not working #367

Open alphanoob1337 opened 3 months ago

alphanoob1337 commented 3 months ago

Environment (OS, Python version, PySpice version, simulator)

Windows 10, Python 3.11, PySpice 1.5, NgSpice

Expected Behaviour

The only way to import the Circuit class is using from PySpice.Spice.Netlist import Circuit which does not offer any possibilities to resolve naming conflicts and therefore I am not using the from ... import ... syntax.

I would expect import PySpice.Spice.Circuit or something similar to work but it does not since PySpice/Spice/__init__.py does not expose the Circuit class. Also a class Netlist is defined in Netlist.py which results in PySpice.Spice.Netlist referring to the object rather than the Netlist.py file.

Actual Behaviour

ModuleNotFoundError                       Traceback (most recent call last)
Cell In [1], line 7
      4 import PySpice.Logging.Logging as Logging
      5 logger = Logging.setup_logging()
----> 7 import PySpice.Spice.Netlist.Circuit
      8 from PySpice.Unit import *
      9 import scipy.optimize

ModuleNotFoundError: No module named 'PySpice.Spice.Netlist.Circuit'; 'PySpice.Spice.Netlist' is not a package

Steps to reproduce the behaviour

Run import PySpice.Spice.Netlist.Circuit.