When you import lib
, you’re importing the package. The only file to get evaluated and run in this case is the 0 byte __init__.py
in the lib directory.
If you want access to your function, you can do something like this from lib.mod1 import mod1
and then run the mod12
function like so mod1.mod12()
.
If you want to be able to access mod1
when you import lib
, you need to put an import mod1
inside the __init__.py
file inside the lib
directory.
Related Posts:
- What is a Python egg?
- How to install pip with Python 3?
- Relative imports – ModuleNotFoundError: No module named x
- Relative imports – ModuleNotFoundError: No module named x
- “pip install unroll”: “python setup.py egg_info” failed with error code 1
- “pip install unroll”: “python setup.py egg_info” failed with error code 1
- What is __init__.py for?
- What is __init__.py for?
- beyond top level package error in relative import
- beyond top level package error in relative import
- ModuleNotFoundError: No module named ‘sklearn’
- beyond top level package error in relative import
- ModuleNotFoundError: No module named ‘sklearn’
- Python 3: ImportError “No Module named Setuptools”
- What’s the difference between a Python module and a Python package?
- How to fix “Attempted relative import in non-package” even with __init__.py
- How to fix “Attempted relative import in non-package” even with __init__.py
- Can’t import my own modules in Python
- What’s the difference between a Python module and a Python package?
- How do I update a Python package?
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- What does if __name__ == “__main__”: do?
- How to fix IndexError: invalid index to scalar variable
- How to write inline if statement for print?
- Could not install packages due to a “Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py'”
- ^=, -= and += symbols in Python
- How does numpy.newaxis work and when to use it?
- “If not” condition statement in python
- How to move a file in Python?
- Round a floating-point number down to the nearest integer?
- How can I sort a dictionary by key?
- How do you append to a file?
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Jupyter Notebook not saving: ‘_xsrf’ argument missing from post
- Does Python have “private” variables in classes?
- Rename Pandas DataFrame Index
- What are metaclasses in Python?
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How to upgrade pip3?
- Is module __file__ attribute absolute or relative?
- Python: How do I make a subclass from a superclass?
- How do I convert a list of ascii values to a string in python?
- How can I compare two lists in python and return matches
- Convert DataFrame column type from string to datetime, dd/mm/yyyy format
- How can I remove a trailing newline?
- TypeError: unsupported operand type(s) for -: ‘list’ and ‘list’
- How to overcome “datetime.datetime not JSON serializable”?
- AttributeError: ‘datetime’ module has no attribute ‘strptime’
- Where does this come from: -*- coding: utf-8 -*-
- Open file in a relative location in Python
- Python – TypeError: Object of type ‘int64’ is not JSON serializable
- Python add item to the tuple
- How to print a dictionary’s key?
- Python setup.py develop vs install
- Selenium using Python – Geckodriver executable needs to be in PATH
- Spark RDD to DataFrame python
- index 1 is out of bounds for axis 0 with size 1
- How to check the version of scipy
- How to check if type of a variable is string?
- How to print colored text to the terminal
- Understanding NumPy’s einsum
- For loop and ‘numpy.float64’ object is not iterable error
- What are the causes of overflow encountered in double_scalars besides division by zero?
- Creating a dictionary from a csv file?
- How can I check for NaN values?
- Bad operand type for unary +: ‘str’
- How do I get the parent directory in Python?
- AttributeError: ‘Tensor’ object has no attribute ‘_keras_history’
- pip install -r requirements.txt [Errno 2] No such file or directory: ‘requirements.txt’
- Zsh: Conda/Pip installs command not found
- Find the nth occurrence of substring in a string
- How to convert ‘binary string’ to normal string in Python3?
- What is the meaning of curly braces?
- Copy a list of list by value and not reference
- Python – While-Loop until list is empty
- ImportError: No module named xgboost
- How to properly create a HeatMap with Bokeh
- How to detect key presses?
- NaN loss when training regression network
- Building multi-regression model throws error: `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`
- TypeError: ‘set’ object does not support indexing
- Python 3.6 No module named pip
- Difference between import tkinter as tk and from tkinter import
- Split function add: \xef\xbb\xbf…\n to my list
- What does on_delete do on Django models?
- Convert floats to ints in Pandas?
- Unable to import tweepy module
- pandas comparison raises TypeError: cannot compare a dtyped [float64] array with a scalar of type [bool]
- NameError: name ‘python’ is not defined
- What is an easy way to implement fprintf in python?
- What is the recommended way to use Vim folding for Python code
- Plotting a python dict in order of key values
- How to normalize a NumPy array to within a certain range?
- Difference between exit(0) and exit(1) in Python
- IOError: [Errno 32] Broken pipe when piping: `prog.py | othercmd`
- Python ‘while’ with two conditions: “and” or “or”
- How to pass a list by reference?
- Python Quicksort Runtime Error: Maximum Recursion Depth Exceeded in cmp
- Sending posts from Python to WordPress
- i want to run python script in wordpress