I am trying to figure out how to reference a function in a .py
file from another .py
file in the same directory. I have followed the python.org Modules instructions, but I can't get it to work.
Here is what I have so far:
This is the file `mymodule.py' that contains the function:
# -*- coding: utf-8 -*-
# Define plus_two function
def plus_two(x):
print(x+2)
Here is the file that calls the function:
# -*- coding: utf-8 -*-
import mymodule
x=4
mymodule.plus_two(x)
It should print 6, but it just gives this error: ModuleNotFoundError: No module named 'mymodule'
The mymodule.py
file has been saved, and I know the function works fine.