Building the request-reply automation system
Finally, we can begin putting theory into practice, and build our request-reply Maya automation system.
We'll start by learning how Python packages work, how to bootstrap Maya from another process, and how process pipes work. After that, we will set up a bare bones client and server. Once that is working, we will add support for exec
and eval
, exceptions, timeouts, and more.
Creating a Python package
Before writing our code, we need to create some files. Because these files are all closely related, we can put them in a folder and create a Python package.
Start by creating a mayaserver
directory in your development root. For this book, that is C:\mayapybook\pylib\mayaserver
. Inside, create three empty files: __init__.py
, client.py
, and server.py
.
The __init__.py
file is what turns this folder in a package. It allows us to do things like import mayaserver
, which would import the __init__.py
file, and import mayaserver.client
and import mayaserver.server...