🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 1 (from laksa156)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
18 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.6 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://betterstack.com/community/questions/how-to-use-relative-imports-in-python/
Last Crawled2026-04-01 22:28:56 (18 days ago)
First Indexed2024-08-06 21:23:50 (1 year ago)
HTTP Status Code200
Meta TitleHow to Use Relative Imports in Python? | Better Stack Community
Meta DescriptionAI SRE and MCP server, incident management, on-call, logs, metrics, traces, and error tracking. 7,000+ happy customers. 60-day money back guarantee.
Meta Canonicalnull
Boilerpipe Text
Better Stack Team Updated on June 19, 2024 Relative imports in Python are used to import modules relative to the current module's location in the package hierarchy. They are specified using dot notation to indicate the relative position of the module to be imported. Here's how you can use relative imports: Suppose you have the following package structure: Copied! Now, if you're in module1.py and you want to import module2.py , you can use a relative import: Copied! Similarly, if you're in submodule1.py and you want to import module1.py , you can use a relative import: Copied! In relative imports: A single dot . refers to the current package. Two dots .. refer to the parent package. You can use multiple dots to traverse up the package hierarchy as needed. It's important to note that relative imports only work within packages. If you're trying to run a module directly as a script, relative imports will not work. In that case, you should use absolute imports or execute the module as part of a package. Got an article suggestion? Let us know Explore more This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Markdown
Platform [AI SRE Agentic root cause analysis](https://betterstack.com/ai-sre) [Incident management & on-call Move fast when things break](https://betterstack.com/incident-management) [Uptime monitoring The most reliable uptime monitoring](https://betterstack.com/uptime) [Status page Communicate downtime & build trust](https://betterstack.com/status-page) [Tracing eBPF-based OpenTelemetry-native tracing](https://betterstack.com/tracing) [Log management Collect insights across your stack](https://betterstack.com/log-management) [Infrastructure monitoring OpenTelemetry-native infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Real user monitoring Session replay, web vitals & product analytics](https://betterstack.com/real-user-monitoring) [Error tracking AI‑native error tracking built on Better Stack](https://betterstack.com/error-tracking) [Data warehouse Time series data warehouse as an API](https://betterstack.com/warehouse) [Documentation](https://betterstack.com/docs/) [Pricing](https://betterstack.com/pricing) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) [Blog](https://betterstack.com/community/blog) [Changelog](https://betterstack.com/tag/changelog) [Enterprise](https://betterstack.com/enterprise) [Sign in](https://betterstack.com/users/sign-in) [Sign up](https://betterstack.com/users/sign-up) Platform [Documentation](https://betterstack.com/docs/) [Pricing](https://betterstack.com/pricing) Community Company [Enterprise](https://betterstack.com/enterprise) Back [AI SRE Agentic root cause analysis](https://betterstack.com/ai-sre) [Incident management & on-call Move fast when things break](https://betterstack.com/incident-management) [Uptime monitoring The most reliable uptime monitoring](https://betterstack.com/uptime) [Status page Communicate downtime & build trust](https://betterstack.com/status-page) [Tracing eBPF-based OpenTelemetry-native tracing](https://betterstack.com/tracing) [Log management Collect insights across your stack](https://betterstack.com/log-management) [Infrastructure monitoring OpenTelemetry-native infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Real user monitoring Session replay, web vitals & product analytics](https://betterstack.com/real-user-monitoring) [Error tracking AI‑native error tracking built on Better Stack](https://betterstack.com/error-tracking) [Data warehouse Time series data warehouse as an API](https://betterstack.com/warehouse) Back [Community home](https://betterstack.com/community) [Guides](https://betterstack.com/community/guides) [Questions](https://betterstack.com/community/questions) [Comparisons](https://betterstack.com/community/comparisons) Back [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) [Blog](https://betterstack.com/community/blog) [Changelog](https://betterstack.com/tag/changelog) Questions [Community](https://betterstack.com/community/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) [Guides](https://betterstack.com/community/guides/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) [Questions](https://betterstack.com/community/questions/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) [Comparisons](https://betterstack.com/community/comparisons/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) [Blog](https://betterstack.com/community/blog/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) - [Community](https://betterstack.com/community/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) - [Guides](https://betterstack.com/community/guides/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) - [Questions](https://betterstack.com/community/questions/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) - [Comparisons](https://betterstack.com/community/comparisons/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) - [Blog](https://betterstack.com/community/blog/?utm_content&utm_medium=questions&utm_source=community&utm_term=how-to-use-relative-imports-in-python) [Docs](https://betterstack.com/docs/) [Documentation](https://betterstack.com/docs/) # How to Use Relative Imports in Python? Better Stack Team Updated on June 19, 2024 Relative imports in Python are used to import modules relative to the current module's location in the package hierarchy. They are specified using dot notation to indicate the relative position of the module to be imported. Here's how you can use relative imports: Suppose you have the following package structure: Copied\! ``` my_package/ __init__.py module1.py module2.py subpackage/ __init__.py submodule1.py ``` Now, if you're in `module1.py` and you want to import `module2.py`, you can use a relative import: Copied\! ``` # module1.py # Relative import of module2.py from . import module2 ``` Similarly, if you're in `submodule1.py` and you want to import `module1.py`, you can use a relative import: Copied\! ``` # submodule1.py # Relative import of module1.py from .. import module1 ``` In relative imports: - A single dot `.` refers to the current package. - Two dots `..` refer to the parent package. - You can use multiple dots to traverse up the package hierarchy as needed. It's important to note that relative imports only work within packages. If you're trying to run a module directly as a script, relative imports will not work. In that case, you should use absolute imports or execute the module as part of a package. Got an article suggestion? [Let us know](mailto:hello@betterstack.com?subject=Suggestion%20for%20How%20to%20Use%20Relative%20Imports%20in%20Python%3F&body=) Explore more [Python](https://betterstack.com/tag/python) [How can I import a Python module dynamically given the full path? ![]() Questions](https://betterstack.com/community/questions/how-to-import-python-module-dynamically/) [Importing files from different folder in Python? ![]() Questions](https://betterstack.com/community/questions/importing-files-from-different-folders-python/) [![Licensed under CC-BY-NC-SA]()](https://creativecommons.org/licenses/by-nc-sa/4.0/) This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - [How can I import a Python module dynamically given the full path? Importing programmatically To programmatically import a module, use\&nbsp;importlib.import\_module(). import importlib itertools = importlib.import\_module('itertools') Checking if a module can be imp... ![]() Questions](https://betterstack.com/community/questions/how-to-import-python-module-dynamically/) - [Importing files from different folder in Python? In Python, you can use the import statement to import modules or files from different folders. If the file you want to import is in a different folder than the script you are running, you will need... ![]() Questions](https://betterstack.com/community/questions/importing-files-from-different-folders-python/) Solutions [AI SRE](https://betterstack.com/ai-sre) [OpenTelemetry tracing](https://betterstack.com/tracing) [Log management](https://betterstack.com/telemetry) [Infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Error tracking](https://betterstack.com/error-tracking) [Real user monitoring](https://betterstack.com/real-user-monitoring) [Incident management](https://betterstack.com/incident-management) [Uptime monitoring](https://betterstack.com/uptime) [Status page](https://betterstack.com/status-page) [Data warehouse](https://betterstack.com/warehouse) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) Resources [Help & Support](https://betterstack.com/help) [Documentation](https://betterstack.com/docs/) [Enterprise](https://betterstack.com/enterprise) [Integrations](https://betterstack.com/integrations) [Dashboards](https://betterstack.com/dashboards) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) Resources [Help & Support](https://betterstack.com/help) [Documentation](https://betterstack.com/docs/) [Enterprise](https://betterstack.com/enterprise) [Integrations](https://betterstack.com/integrations) [Dashboards](https://betterstack.com/dashboards) Community [What Is Incident Management? Beginner’s Guide](https://betterstack.com/community/guides/incident-management/what-is-incident-management/) [Best Datadog Alternatives to Consider in 2026](https://betterstack.com/community/comparisons/datadog-log-management-alternatives/) [8 Best Free & Open Source Status Page Tools in 2026](https://betterstack.com/community/comparisons/free-status-page-tools/) [13 Best Sentry Alternatives in 2026](https://betterstack.com/community/comparisons/sentry-alternatives/) [15 Best Grafana Alternatives in 2026](https://betterstack.com/community/comparisons/grafana-alternatives/) [The 10 Best Incident.io Alternatives in 2026](https://betterstack.com/community/comparisons/incident-io-alternative/) [5 Most Used Incident Management Tools](https://betterstack.com/community/comparisons/incident-management-tools/) 30x cheaper than Datadog. Predictable pricing. Exceptional customer support. [\+1 (628) 900-3830](<tel:+1 (628) 900-3830>) [hello@betterstack.com](mailto:hello@betterstack.com) [Terms of Use](https://betterstack.com/terms) [Privacy Policy](https://betterstack.com/privacy) [GDPR](https://betterstack.com/dpa) [System status](https://status.betterstack.com/) © 2026 Better Stack, Inc. ### Please accept cookies We use cookies to authenticate users, improve the product user experience, and for [personalized ads](https://business.safety.google/privacy/). [Learn more.](https://betterstack.com/privacy) Deny Accept required Accept all
Readable Markdown
Better Stack Team Updated on June 19, 2024 Relative imports in Python are used to import modules relative to the current module's location in the package hierarchy. They are specified using dot notation to indicate the relative position of the module to be imported. Here's how you can use relative imports: Suppose you have the following package structure: Copied\! Now, if you're in `module1.py` and you want to import `module2.py`, you can use a relative import: Copied\! Similarly, if you're in `submodule1.py` and you want to import `module1.py`, you can use a relative import: Copied\! In relative imports: - A single dot `.` refers to the current package. - Two dots `..` refer to the parent package. - You can use multiple dots to traverse up the package hierarchy as needed. It's important to note that relative imports only work within packages. If you're trying to run a module directly as a script, relative imports will not work. In that case, you should use absolute imports or execute the module as part of a package. Got an article suggestion? [Let us know](mailto:hello@betterstack.com?subject=Suggestion%20for%20How%20to%20Use%20Relative%20Imports%20in%20Python%3F&body=) Explore more [![Licensed under CC-BY-NC-SA](https://betterstack.com/assets/articles/cc-by-nc-sa-198c1f75.png)](https://creativecommons.org/licenses/by-nc-sa/4.0/) This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Shard1 (laksa)
Root Hash1143718778839325401
Unparsed URLcom,betterstack!/community/questions/how-to-use-relative-imports-in-python/ s443