Hi Hrutvik, After run script.py, enter 'load filenane' to run the function. Your function load() only prints the PyMOL commands that you want to execute.
Add below or above the print lines, add these indented lines. cmd.do("load 1u8q.pdb") cmd.do("color red, (chain y)" ) You might consider splitting the load and color into two separate functions to make your code easier to read and use. Functions in Python are suppose to do only one thing. Best regards, Blaine Blaine Mooers, Ph.D. Associate Professor Department of Biochemistry and Molecular Biology College of Medicine University of Oklahoma Health Sciences Center S.L. Young Biomedical Research Center (BRC) Rm. 466 975 NE 10th Street, BRC 466 Oklahoma City, OK 73104-5419 ________________________________________ From: Hrutvik Bhavsar [hrutvi...@gmail.com] Sent: Wednesday, July 01, 2020 6:26 PM To: pymol-users@lists.sourceforge.net Subject: [EXTERNAL] [PyMOL] Question about python commands in PyMOL Hello, I'm writing a python script that loads in PDBs then selects certain chains colors them according to a standardized chart. However, I've run into the issue where my when I try running my script in Pymol via the run command it just displays the text on the python script but doesn't actually execute the command. I've pasted a sample script below. Please let me if there's a way to fix this. Thank you for your help. Sincerely, Hrutvik. from pymol import cmd, stored def load( arg1): print ("load 1u8q.pdb") print ("color red, (chain y)" + "\n") return (arg1) cmd.extend( "load", load ); cmd.extend( "color", color ); _______________________________________________ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe