visLoad will load an object and show it in your desired representation. PyMOL by default loads things as lines (or spheres, a setting you may change), but not others.
- Save the code to "visLoad.py".
- Run the code from PyMOL or put it in your .pymolrc
- Use visLoad whenever you would use load
- To change representations, update "cartoon" to something else, or add more intermediate commands.
from os import path
from pymol import cmd
def visLoad(filename, object=None, *args, **kwargs):
object = os.path.basename(filename).split(".")
cmd.load(filename, object, *args, **kwargs)