A project has the following structure:
modulename
├── __init__.py
│
├── one
│   ├── function_1.py
│   ├── function2.py
│   └─── __init__.py
│
└── two
    ├── another_function.py
    ├── yet_another_function.py
    └─── __init__.py
Each .py (except the __init__.py's which are empty) has content along the lines of:
def foo(x):
    return x
def bar(x):
    return x + 2
To use the module you import it it in the following way: import modulename.one.function1.foo. What I want to do is find all .py file names in the second to last place, for example function1 or another_function.
The suggested solutions so far has unsuccessfully been:
- dir(modulename.one)which results in- ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__'].
- help(modulename.one)which actually includes the function files' names under the title- PACKAGE CONTENTS. How do I get a list of the- PACKAGE CONTENTS?
EDIT: I could (as someone suggested) use __all__ in the __init__.py's, but I would prefer a simple built-in function or module.
 
    