Illscha
Illscha

Reputation: 33

Python script that runs from MEL Command

I wrote this Python script that should run when I use my MEL command. It worked before when I tested it on my school computer. But now it doesn't seem to work, I don't know if it's changed since last, I can't see that it is either.

When I run it now, it says it can't find the path of the module. Here's the correct error line.

Error: ImportError: No module named inlupp3

I have the script on: D:\Autodesk\maya2012\script

Here's my Python script:

import maya.cmds as mc
import math
import random as rdm
import inlupp3 as in3
reload(mm)

def Spiral():
    currentFrame = mc.currentTime( q = True )
    startFr =  mc.currentTime( 1 )
    endFr = 200
    qtyPlap = 5
    aspPlap = 15
    rad = 10
    origObj = "pCube1"

if currentFrame % 10 == 0:
   mm.clickOK() 

rdmX = rdm.uniform( -0.8, 0.8 )
rdmY = rdm.uniform( -0.8, 0.8 )
rdmZ = rdm.uniform( -0.8, 0.8 )
mc.move( rdmX, rdmY, rdmZ, "pCube1", relative = True, localSpace = True )

And here's my MEL command:

python( "import inlupp3 as inl3" ) ;
python( "reload( mm )" ) ;
python( "inl3.clickOK( 1, 200, 5, 15, 10, 'pCube1' )" ) ;

Upvotes: 0

Views: 3333

Answers (1)

cronicryo
cronicryo

Reputation: 437

first and foremost put your script is in the right file path which is in your C:\Users[username]\Documents\maya\scripts

next if the first snippet you provided has import inlupp3 as in3 you cannot import it to itself

your reload(mm) im not sure what this is referring to but if your trying to reload your module you need to have then it should be reload(inl3)

you also have in3 as the module in the top snippet and inl3 in the second snippet

i also reccomend taking out numbers in your file name

Upvotes: 0

Related Questions