Importing a function/class from a Python module of the same name
- by Brendan
I have a Python package mymodule with a sub-package utils (i.e. a subdirectory which contains modules each with a function). The functions have the same name as the file/module in which they live.
I would like to be able to access the functions as follows,
from mymodule.utils import a_function
Strangely however, sometimes I can import functions…