accessing maya's interpreter globals from another scripts

51 views
Skip to first unread message

Rudi Hammad

unread,
Nov 10, 2021, 4:36:13 AM11/10/21
to Python Programming for Autodesk Maya
Hello,

I was wondering if it is possible to get the globals variables running in maya but from another script.
For instance say you have a module foo.py. Can you use get all maya's globals as if you were running 'globals()' withing maya's interpreter?

thx,

T

Marcus Ottosson

unread,
Nov 10, 2021, 6:24:52 AM11/10/21
to python_in...@googlegroups.com
Global variables are.. global, so anything present in `globals()` from one module is present in another. Are you seeing different results from `globals()` in `foo.py` versus Maya's interpreter (by which I assume you mean the Script Editor)?

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/46ad99b5-42d5-40dd-ba99-74b546516426n%40googlegroups.com.

Rudi Hammad

unread,
Nov 10, 2021, 6:52:29 AM11/10/21
to Python Programming for Autodesk Maya
of course, in foo.py you get the module's global, and in maya's script editor you see maya's.
So I was wondering if you can query maya's globals (or locals) from an other foo.py.
I know, it is a strange question.

Rudi Hammad

unread,
Nov 10, 2021, 6:55:32 AM11/10/21
to Python Programming for Autodesk Maya
in other words, get the result in foo.py that you get when you run globals() in maya's script editor.

Justin Israel

unread,
Nov 10, 2021, 12:07:01 PM11/10/21
to python_in...@googlegroups.com


On Thu, 11 Nov 2021, 12:55 am Rudi Hammad, <rudih...@gmail.com> wrote:
in other words, get the result in foo.py that you get when you run globals() in maya's script editor.

You can reference what I am going in the MayaSublime project. I import __main__ and access __main__.__dict__ for the globals as you would see them in the script editor


Rudi Hammad

unread,
Nov 10, 2021, 12:33:58 PM11/10/21
to Python Programming for Autodesk Maya
that's it! thanks
Reply all
Reply to author
Forward
0 new messages