1. The called module: my_module.py
2. Call the module: function.py
It can be seen that the function in the my_module.py file is called in the function.py file. Under normal circumstances, if you want to call a function, you must import the module where it is located, that is, its file name. If you want to use the "c_to_f()" function in the my_module.py file, you must "import my_module".
But as shown in the figure above: "import my_module" is gray, indicating that the reference failed.
3. Solution:
Check the error message first: unused import statement "import my_module"
means: unused import statement "import my_module". The reason for this problem is that you must be more specific when specifying functions defined in other modules in Python. One way to solve this problem is to replace this line of code: fahrenheit = c_to_f(celsius) with: fahrenheit = my_module.c_to_f(celsius). In this way, you can see that "import my_module" has become the normal color.