Closed GoogleCodeExporter closed 9 years ago
Some more information ...
Traceback (most recent call last):
File "./ut.py", line 9, in <module>
mymodule.myinit_GPI()
File "/home/pi/scripts/mymodule.py", line 2, in myinit_GPI
GPIO.setmode(GPIO.BCM)
NameError: global name 'GPIO' is not defined
Original comment by pef...@gmail.com
on 3 Nov 2013 at 8:40
More Info : If I put all code in the same main program it work fine !!!
The problem is only if I use import of mymodule.myinit_GPI()
If I add som mymodule.simple() it works fine.
"simple()
"print "Hi"
"return
Original comment by pef...@gmail.com
on 3 Nov 2013 at 1:32
This is not an issue with RPi.GPIO. It is an issue with your code.
To fix your problem, add the line:
import RPi.GPIO as GPIO
at the beginning of mymodule.py
You need to import every dependency of a module at the top of a module, just
like you would in your main program.
Original comment by btcros...@googlemail.com
on 3 Nov 2013 at 8:12
Original issue reported on code.google.com by
pef...@gmail.com
on 3 Nov 2013 at 8:34