Ensure the file apikey.py is in the same directory and doesn’t have a name conflict — use import apikey without the .py extension.
Here is the code snippet you can refer to:

In the above code we are using the following key points:
- Imports the apikey module without the .py extension.
- Ensures both files are in the same directory.
- Accesses a variable (API_KEY) from the apikey module.
Hence, keeping file placement and naming consistent ensures proper import of Python modules like apikey.py.