I'm trying to import a module to connect to my wifi. i'm using a module because i don't want the ssid or password to be tracked on github
But it don't work in my main.py. In repl it works fine, I import ConnectWifi in both main.py and in the repl prompt and :
Code: Select all
connect to wifi
Traceback (most recent call last):
File "main.py", line 15, in <module>
NameError: name 'ConnectWiFi' isn't defined
MicroPython v1.10-331-ge38c68310-dirty on 2019-05-09; ESP32 module with ESP32
Type "help()" for more information.
>>> import ConnectWifi
>>> ConnectWifi.greetings()
Hellooooo !
>>>
Code: Select all
import ConnectWifi
try:
ConnectWifi
except NameError:
print("no ConnectWifi")
else:
print("connect to wifi")
ConnectWiFi.greetings()
Am i doing something wrong?