Home Website Youtube GitHub

Accessing path variables between pre scripts [QUESTION]

Hello everyone,

I am trying to create an example path.py in my pre scripts just so I could store my variables and then use it in different python files but I don’t know the proper way to do this.

I tried doing with self but seems it has no effect. Any suggestions?

Hey @Lethendris,

I think I see the direction that you are trying to go in, so now that you have those class variables defined, you can access them within another pre/post build step.

If you had to create another pre build step python called import_asset/model you can do something like:

# -- grapping the asset path from previous pre step
file_path = self.custom_step("paths").asset_path

# -- do the import
cmds.file(file_path, i=True, type="mayaAscii")

In Maya, when you have your custom steps tab open, you can select the “paths” file that you have and click run sel. If you have a print statement or some form of output to confirm that the results are what you are expecting, then this helps with the process too.

Hope that helps man! :grinning:

1 Like

Oh man, custom_step is the function I was looking for. It worked, THANKS!

1 Like