How to run a Maya Python script

Overview

How to run a Python script in Maya. (It is quite suitable)

Maya doesn't execute the script when I D & D it. You can write it directly in the editor and execute it, You can't use it with relative paths or scripts you want to use. Make a note because I will soon forget the solution in such a case.

code

import pymel.core as pm
import sys

p = r"<Full path of the folder containing the script>"
if not p in sys.path: sys.path.append(p)

import <script name>
reload(<Script name>)

test=<Script name.name of the class()>
<Script name.Method name()>

If you want to open the window If you create a method for it, it will appear just by calling it.

Recommended Posts

How to run a Maya Python script
How to run a Python program from within a shell script
How to run Notepad ++ Python
A memorandum to run a python script in a bat file
How to write a Python class
How to run a Python file at a Windows 10 command prompt
[Python] How to make a class iterable
[Python] How to convert a 2D list to a 1D list
[Python] How to invert a character string
[Ubuntu] How to execute a shell script
Run the Python interpreter in a script
How to get a stacktrace in python
How to pass arguments to a Python script in SPSS Modeler Batch
How to install Python
How to install python
Run a Python script from a C # GUI application
How to read a CSV file with Python 2/3
How to create a Python virtual environment (venv)
How to open a web browser from python
How to clear tuples in a list (Python)
How to embed a variable in a python string
How to create a JSON file in Python
How to run some script regularly in Django
How to run MeCab on Ubuntu 18.04 LTS Python
How to generate a Python object from JSON
How to add a Python module search path
How to notify a Discord channel in Python
How to run Leap Motion in non-Apple Python
[Python] How to draw a histogram in Matplotlib
Run a python script from excel (using xlwings)
[2020.8 latest] How to install Python
How to add help to HDA (with Python script bonus)
How to install Python [Windows]
How to write a GUI using the maya command
python3: How to use bottle (2)
[Python] How to draw a line graph with Matplotlib
How to set up a Python environment using pyenv
A road to intermediate Python
[Python] How to use list 1
How to run python in virtual space (for MacOS)
How to call a function
How to update Python Tkinter to 8.6
How to run tests in bulk with Python unittest
Create a plugin to run Python Doctest in Vim (2)
How to write a list / dictionary type of Python3
How to use Python argparse
How to build a Django (python) environment on docker
How to hack a terminal
Python: How to use pydub
How to make a Python package using VS Code
How to run setUp only once in python unittest
[Python] How to write a docstring that conforms to PEP8
[Python] How to use checkio
How to save a table scraped by python to csv
How to create a simple TCP server / client script
How to change Python version
Python script to create a JSON file from a CSV file
[Python] How to create a 2D histogram with Matplotlib
How to develop in Python
How to execute a command using subprocess in Python
How to run Django on IIS on a Windows server