On Fri, Mar 20, 2015 at 8:25 AM KristoNovo <[email protected]> wrote:
> Hi Folks,
>
> as a Web-Developer I´m used to the principles of HTTP which means it´s an
> ongoing story of request and response. Before diving into Python within
> Maya I´d like to clarify things. When a Script is called which references a
> class and changes the value of a property: Will this change be kept the
> whole time Maya is running?
>
Maya is an application that contains an embedded Python environment. This
Python environment is persistent for the life of the Maya process. Things
you do in the global python namespace are persistent.
So if I understand your question, you are asking about one script importing
some other module, accessing a class, and changing properties on that
class. And whether those changes are persistent for the life of the Maya
process? Yes, when you import a module and access a class, over and over,
the import mechanism in Python would be returning the already loaded module
from sys.modules. So you should end up seeing the same Class object over
and over again. I'm referring to the normal workflow and not what can
happen if you get into forcing reloads and using the underlying python
import functionality directly. But lets leave all that behavior aside.
Normally, when you do this:
from aModule import MyClass
You should end up with the same MyClass for each subsequent invocation.
But honestly, this behavior can be the same in a python-based web server,
depending on how you host the application (uwsgi, fci, cgi, ..) and how
many instances are running. It just depends on if two requests his the same
running instance or not.
--
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/3ee1f0e7-05b6-4012-be2b-c18a746c7c7e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/3ee1f0e7-05b6-4012-be2b-c18a746c7c7e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA08bEx17vuuMp_WzRxroO5pP8dfgRO9AJB9nrCxDwC7mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.