
Dear ChimeraX team, May I ask a basic question regarding running Python scripts in ChimeraX? I’m trying to execute a simple test script using the runscript command from the ChimeraX command window: runscript ~/Desktop/test_print.py Here is the content of test_print.py: def run(session, data=None): session.logger.info("✅ Successfully executed runscript_test.py!") from chimerax.core.commands import run as cxrun cxrun(session, "log clear") cxrun(session, "log info ✅ runscript_test.py is working") However, nothing seems to happen—there is no output in the log window, and it seems the script is not being executed at all. Ultimately, I would like to perform a coordinate transformation on a structure in ChimeraX using the equation: r = RM * r0 where: RM = [ 0.323, 0.9326, -0.1611], [-0.925, 0.2751, -0.2623], [-0.2003, 0.2337, 0.9515] But I am currently stuck at the first step: getting a Python script to run properly in ChimeraX. Any advice or suggestions would be greatly appreciated! Best regards, Zhen Gong

Zhen Gong, Your script is defining a function, but it doesn't call the function. Adding 'run(session)' to the bottom of your script should result in the log being cleared, etc. Also as far as I know, there is no "info" option for the log command, but the session.logger.info will work. Best, Tony On Thu, Jun 26, 2025 at 10:21 PM zg2234--- via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Dear ChimeraX team,
May I ask a basic question regarding running Python scripts in ChimeraX? I’m trying to execute a simple test script using the runscript command from the ChimeraX command window:
runscript ~/Desktop/test_print.py Here is the content of test_print.py:
def run(session, data=None): session.logger.info("✅ Successfully executed runscript_test.py!") from chimerax.core.commands import run as cxrun cxrun(session, "log clear") cxrun(session, "log info ✅ runscript_test.py is working")
However, nothing seems to happen—there is no output in the log window, and it seems the script is not being executed at all.
Ultimately, I would like to perform a coordinate transformation on a structure in ChimeraX using the equation:
r = RM * r0 where:
RM = [ 0.323, 0.9326, -0.1611], [-0.925, 0.2751, -0.2623], [-0.2003, 0.2337, 0.9515]
But I am currently stuck at the first step: getting a Python script to run properly in ChimeraX.
Any advice or suggestions would be greatly appreciated!
Best regards, Zhen Gong _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/

Thank you very much Tony. I got it run. Do you know how to use the ChimeraX API by the way? Zhen
participants (2)
-
Tony Schaefer
-
zg2234@cumc.columbia.edu