Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import ?
#4
A module can be as simple as a single python file. By default, it looks for modules in your PYTHONPATH (to view it at runtime, do import sys and then print(sys.path).

If a <module>.py file is in there, or if you have a <module> directory with the right construction, it will be imported.

The "6.1.2 module search path" and "6.4 Packages" (for understanding the PyBluez setup) are important bits from the links in Yoriz's post. They're not just definitions.

$ echo 'print("Hello, I am a module")' > foo.py
$ python3
Python 3.8.2 (default, Feb 27 2020, 15:22:23)
[Clang 11.0.0 (clang-1100.0.33.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
Hello, I am a module
Reply


Messages In This Thread
import ? - by anne - Jul-29-2020, 10:20 PM
RE: import ? - by Yoriz - Jul-29-2020, 10:26 PM
RE: import ? - by anne - Jul-30-2020, 12:21 AM
RE: import ? - by bowlofred - Jul-30-2020, 01:15 AM
RE: import ? - by millpond - Jul-30-2020, 01:43 AM
RE: import ? - by anne - Jul-30-2020, 03:51 AM
RE: import ? - by millpond - Jul-30-2020, 04:22 AM
RE: import ? - by elenaflorence87 - Jul-30-2020, 04:51 AM
RE: import ? - by anne - Jul-30-2020, 02:22 PM
RE: import ? - by anne - Jul-30-2020, 04:34 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020