schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.15k stars 275 forks source link

Question about the `__name__` variable in plugins #379

Open pslacerda opened 2 months ago

pslacerda commented 2 months ago

Why I need to use "pmg_tk.startup.XDrugPy" when testing for __name__ when loading plugins? I test for __name__ because I can't use pymol.Qt from command line scripts.

if __name__ in ["pymol", "pmg_tk.startup.XDrugPy"]:
    import pymol

    QWidget = pymol.Qt.QtWidgets.QWidget
    ...

https://gist.github.com/pslacerda/1e6a14cbe3fc7aeb2425e0a5d74ddc78#file-xdrugpy-py-L853

Note: I'm using PyMOL 2.6 LTS.