I try to import and run selfmade modules under Spyder. The main.py programm
import rot
f=rotor(b_x,b_y,b_z,x,y,z)
The rot.py programm
def rotor(bx,by,bz,x,y,z):
import numpy as np
...
The issue is:
File "C:\Users\Professional.spyder-py3\my_pro\jgut\main.py", line 93, in f=rotor(b_x,b_y,b_z,x,y,z)
NameError: name 'rotor' is not defined
Problem doesn't disappear even after starting brut force start of any imported modules. Is there a way to start all imported modules simultaniously? Or maybesomeone faced this problem?
P.S. Problem appeared today after Anaconda reinstall, becouse of incopatebilities with IK-Multimedia apps (I just removed them). I was starting all the mudules by brut force from the begining.
1) Please, do not import modules in functions!
2) rotor
is not defined because it is in the rot
namespace. You can call it by rot.rotor(args)
. If you wanted to do call it the way you do, you have to import it like this: from rot import rotor
or from rot import *
(which imports everything from the rot module and is a bad practise - you should only import what you need).
The error has nothing to do with anything written in the last 2 paragraphs.