私はPythonが初めてで、モジュールまたは関数をインポートする方法を学んでいますが、これらの投稿されたエラーが発生しました。Python コードは次の名前で保存されます。hello_module.py
パイソンコード:
def hello_func():
print ("Hello, World!")
hello_func()
import hello_module
hello_module.hello_func()
エラーメッセージ:
Traceback (most recent call last):
File "C:/Python33/hello_module.py", line 9, in <module>
import hello_module
File "C:/Python33\hello_module.py", line 10, in <module>
hello_module.hello_func()
AttributeError: 'module' object has no attribute 'hello_func'