Hi Tsjerk -
Thanks for the suggestion. I tried this with:
import time
from pymol import cmd
while not hasattr(cmd, 'my_func'):
time.sleep(0.5)
Unfortunately that also causes everything to hang. I think I might need to do
this in a separate thread. I'll have to look into how to do that.
Cheers,
Jared
--
Jared Sampson
Columbia University
On Feb 16, 2016, at 2:47 PM, Tsjerk Wassenaar
<tsje...@gmail.com<mailto:tsje...@gmail.com>> wrote:
Hi Jared,
The extend function must set an attribute "my_func" on cmd. You can test for
that with hasattr:
while not hasattr(cmd, "my_func"):
# wait some more
Hope it helps,
Tsjerk
On Feb 16, 2016 20:07, "Sampson, Jared M."
<jms2...@cumc.columbia.edu<mailto:jms2...@cumc.columbia.edu>> wrote:
To my previous message I should add that it works fine if I do:
```
import pmg_tk.startup.my_plugin as mp
mp.my_func()
```
but I'd like to use the `cmd.my_func()` version, so that `my_func` will work in
a .pml script.
>From `help(cmd)` I found `cmd.kw_list`, but this apparently doesn't include
>"extended" functions, even after the function is loaded.
```
PyMOL>print 'ray' in cmd.kw_list
True
PyMOL>print 'my_func' in cmd.kw_list
False
```
Looking forward to any suggestions. Thanks!
Cheers,
Jared
--
Jared Sampson
Columbia University
On Feb 16, 2016, at 1:50 PM, Sampson, Jared M.
<jms2...@cumc.columbia.edu<mailto:jms2...@cumc.columbia.edu>> wrote:
Hi PyMOLers -
Maybe some more experienced users/developers can help me out here. I'm trying
to write some automated test scripts for the plugin I'm writing, but the test
functions end up running before the plugin is loaded. Is there a way to tell
if a plugin has been loaded from within a .pml or .py script? For example, if
the plugin makes commands available via `cmd.extend('my_func', my_func)`, how
can I run `cmd.myfunc()` from a script and not have it execute before the
plugin finishes loading?
I've tried something like this:
```
import time
from pymol import cmd
loaded = 0
while not loaded:
try:
cmd.my_func() # if it's loaded no exception will be raised
loaded = 1
except:
time.sleep(0.5)
```
But this just hangs, as apparently `time.sleep()` halts the execution of all
threads, so the plugin won't ever be loaded.
Thanks,
Jared
--
Jared Sampson
Columbia University
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________
PyMOL-users mailing list
(PyMOL-users@lists.sourceforge.net<mailto:PyMOL-users@lists.sourceforge.net>)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
PyMOL-users mailing list
(PyMOL-users@lists.sourceforge.net<mailto:PyMOL-users@lists.sourceforge.net>)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net