PyMOL>from pymol2 import PyMOL
PyMOL>a = PyMOL()
PyMOL>print a != None
True
PyMOL>a.start()
PyMOL>a.cmd.load("dat/pept.pdb",quiet=0)
 CmdLoad: "dat/pept.pdb" loaded as "pept".
PyMOL>a.cmd.save("tmp/M0050session.pse",quiet=0)
 Save: wrote "tmp/M0050session.pse".
PyMOL>a.cmd.reset()
PyMOL>print a.cmd.count_atoms()
107
PyMOL>a.cmd.load("tmp/M0050session.pse",quiet=0)
 Executive: Loading version 1.10 session...
PyMOL>print a.cmd.count_atoms()
107
PyMOL>print cmd.count_atoms()
0
PyMOL>a.stop()
PyMOL>del a
