i would like import a file in a blender plugin, which is in the same directory
so i 've written the import, but when i use a class of the file imported, i have this mistake:
NameError: name 'Md3Frame' is not defined
How to resolve this problem?
to include python files in an other script in Blender
Moderators: jesterKing, stiv
add the path to this module to the python path variable
Martin
Code: Select all
import sys
sys.path.append("c:/blah/blah/blah/")
Life is what happens to you when you're busy making other plans.
- John Lennon
- John Lennon
it doesn't work
Here is an example of what i would like doing
my file "module.py"
class Class:
def __init__ (self):
pass
my file "main.py"
import module
import sys
sys.path.append("/home/info/An-01-02/levimond/blender/plugins")
myClass = Class ()
i want execute "main.py" in Blender but i get this mistake:
Traceback (most recent call last):
File "main.py.001", line 6, in ?
NameError: name 'Class' is not defined
So, how can i resolve this problem ?
Here is an example of what i would like doing
my file "module.py"
class Class:
def __init__ (self):
pass
my file "main.py"
import module
import sys
sys.path.append("/home/info/An-01-02/levimond/blender/plugins")
myClass = Class ()
i want execute "main.py" in Blender but i get this mistake:
Traceback (most recent call last):
File "main.py.001", line 6, in ?
NameError: name 'Class' is not defined
So, how can i resolve this problem ?
use either this
or this
Martin
Code: Select all
from module import *
...
myClass = Class()
Code: Select all
import module
...
myClass = module.Class()
Life is what happens to you when you're busy making other plans.
- John Lennon
- John Lennon