I have the following file structure:
command.py
simulations
  basis
    basis.py
  hamiltonian
    hamiltonian.py
where the names without extensions are folders.
- command.pyis importing- basis.pyand- hamiltonian.pylike:
from basis.basis import Basis
from hamiltonian.hamiltonian import Hamiltonian
where Basis and Hamiltonian are two classes.
I can run command.py fine, all the imports are Okay.
- Now, I want to work with - hamiltonian.pyalone, but it needs to import- basis.py.
- In order for - command.pyto work fine, the import in- hamiltonian.pyhas to be- from basis.basis import Basis
- In order for hamiltonian.py to run on its own, the import needs to be - os.chdir('..')
 - from basis.basis import Basis
 however this makes- command.pynot work anymore.
--
1) Can I somehow run the  os.chdir('..') only if hamiltonian.py is run on its own? Like with if name == 'main'?
2) Is there a more elegant solution to this?
 
    