[Pymel] Callback working slowly over VPN

I’m running scripts from home which are located on server.
I connect to server over VPN, then I import module from network path and run application.

I have few of lines like this in every refresh of user interface:

menuItem(“Select used controls”, command=Callback(self.selectControls, poseName))

These lines run instantly (making of UI element) if I run application from PC inside network (not VPN), however
if I run these lines from VPN they take about 0.1s each to process.
If I comment these lines out or just remove command flag refresh of UI is instant.

  1. Does these pymel Callback lines actually save data on server? I presume that lag is because of waiting for server response.

  2. Can I somehow avoid these Callbacks and call directly function from command flag with argument?

I run scripts directly from network because it’s pretty simple so everyone gets updated scripts instantly, I could probably copy these scripts locally every time if there is new version, but I rather not do that.

Thanks for ideas!

You are probably directly or indirectly calling code that is importing or reloading other code. Python has to pull the raw source down again to make sure it hasn’t changed or to recompile the .pyc
The only solution to this that I know of is to make sure that your code doesn’t import or reload anything it doesn’t need, especially inside a callback.

For example, does any of this code end up calling code that evaluates a string as Python code mc.eval(“import somemodule;somemodule.dostuff()”) ?

Few do call some modules, few dont. Some even open some other files from server.
But thing is that, if I comment every line out of the method callback is calling, process is slowed down anyway.

I import these modules in the base of script:
from pymel.core import *
from pymel.util.path import path
import os
import math
import base64
import gzip
import shutil

Hmmm. You might want to monitor what is going on with filemon or procmon…