Andreas,

The trick here is that PyMOL symbols and the PyMOL command line operate
in the pymol namespace, whereas Python modules and plugin each operate
in their own "global" namespace.

Try the following in your plugin:

import pymol
print pymol.colorDict


Cheers,
Warren


--
Warren L. DeLano, Ph.D.                     
Principal Scientist

. DeLano Scientific LLC  
. 400 Oyster Point Blvd., Suite 213           
. South San Francisco, CA 94080 USA   
. Biz:(650)-872-0942  Tech:(650)-872-0834     
. Fax:(650)-872-0273  Cell:(650)-346-1154
. mailto:war...@delsci.com      
 

> -----Original Message-----
> From: pymol-users-ad...@lists.sourceforge.net 
> [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of 
> Andreas Henschel
> Sent: Monday, September 19, 2005 5:05 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Global vars in Plugin name space?
> 
> Hi all,
> 
> I wrote some functions (usually loaded via .pymolrc.py) that 
> establish some information which I would like to use from 
> Plugins, too. In particular, everytime a PQS/PDB protein 
> complex is loaded, I retrieve SCOP data and color domains accordingly.
> I would like to maintain a dictionary that keeps track with 
> loaded SCOP domains. In pymolrc I declare it global, but a 
> plugin that is supposed to read out that dictionary, cannot 
> access PyMOL's global name space:
> 
> The plugin function call contains:
> 
>     global colorDict
>     print colorDict
> 
> and causes
> NameError: global name 'colorDict' is not defined though the 
> direct call from the Prompt works:
> 
> PyMOL>print colorDict ## This still works!
> {'blue': '/1ewf//A/1-217 and not hetatm', 'yellow': 
> '/1ewf//A/218-456 and not hetatm'}
> 
> Is it the only possibility to put all functions that share 
> memory in the same plugin?
> At the moment I simply do it with scripts (which can access 
> global vars), not plugins.
> But in general, is there some info on plugin name spacing 
> (and should it be put to the Wiki Plugin tutorial)?
> 
> Cheers,
> Andreas
> 
> --
> Andreas Henschel
> Bioinformatics Group
> TU Dresden
> Tatzberg 47-51
> 01307 Dresden, Germany
> 
> Phone: +49 351 463 40063
> EMail: a...@biotec.tu-dresden.de
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. 
> Download it for free - -and be entered to win a 42" plasma tv 
> or your very own Sony(tm)PSP.  Click here to play: 
> http://sourceforge.net/geronimo.php
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 
> 
> 
> 

Reply via email to