René's URL Explorer Experiment


Title: Unable to from/import a .NET 8 library · pythonnet/pythonnet · Discussion #2421 · GitHub

Open Graph Title: Unable to from/import a .NET 8 library · pythonnet/pythonnet · Discussion #2421

X Title: Unable to from/import a .NET 8 library · pythonnet/pythonnet · Discussion #2421

Description: Unable to from/import a .NET 8 library

Open Graph Description: I'm trying to pull my .NET library into Python and getting a failure on the from/import statement. Repro Steps: Git clone this repo (.NET 8 class library) Compile the Neighborly library (defaults t...

X Description: I'm trying to pull my .NET library into Python and getting a failure on the from/import statement. Repro Steps: Git clone this repo (.NET 8 class library) Compile the Neighborly library (defaul...

Opengraph URL: https://github.com/pythonnet/pythonnet/discussions/2421

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Unable to from/import a .NET 8 library","text":"

I'm trying to pull my .NET library into Python and getting a failure on the from/import statement.

\n

Repro Steps:

\n
    \n
  1. Git clone this repo (.NET 8 class library)
  2. \n
  3. Compile the Neighborly library (defaults to .NET 8 - Any CPU)
  4. \n
  5. Write a Python script with Pythonnet installed via pip:
  6. \n
\n
clr.AddReference(r\"C:\\MyPathTo\\Neighborly.dll\")\nfrom Neighborly import *\n
\n

Error:

\n
Traceback (most recent call last):\n  File \"c:\\Code\\SampleLib\\Test.py\", line 18, in <module>\n    from Neighborly import *\nModuleNotFoundError: No module named 'Neighborly'\n
\n

Looking at the IL metadata, I can confirm that Neighborly is the assembly name and also the namespace.
\n\"image\"

\n

I created a sample class with an Add function that compiled and was successfully imported into Python.
\nI also added all of the same Nuget dependencies and recompiled them. It continues to call the Add function.
\nThis rules out a dependency load failure.

\n

I'm running on Windows 11 with Python 3.10.11.

\n

Any ideas? 🙏

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

As documented, by default we load a .NET Framework runtime at startup. The simplest option is to run import pythonnet; pythonnet.load(\"coreclr\") before importing clr.

","upvoteCount":2,"url":"https://github.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:da17586e-32e6-3e53-ec58-498517481fc2
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idC8E2:17BD0F:314DBA8:31FF952:697031DA
html-safe-noncea9ab985fa43b437abc693feeb05e5c079f3e19d539f8406eb53b155ad143472c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEUyOjE3QkQwRjozMTREQkE4OjMxRkY5NTI6Njk3MDMxREEiLCJ2aXNpdG9yX2lkIjoiMTAxODUwOTY1ODczODkzMDEzOCIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9
visitor-hmac10fe7055bf93a36029f0748d5712b3e52b216e750bab92113cab9a9d83b95dee
hovercard-subject-tagdiscussion:6969977
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/pythonnet/pythonnet/2421/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/1b750e5f5310c394f78613913c5c58e3460a6e1ec2fe3dae1fa979f8f2e63c3e/pythonnet/pythonnet/discussions/2421
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1b750e5f5310c394f78613913c5c58e3460a6e1ec2fe3dae1fa979f8f2e63c3e/pythonnet/pythonnet/discussions/2421
og:image:altI'm trying to pull my .NET library into Python and getting a failure on the from/import statement. Repro Steps: Git clone this repo (.NET 8 class library) Compile the Neighborly library (defaults t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
turbo-cache-controlno-preview
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef643964067a552f02067066d6a910b2f90a5721f
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2421
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2421
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
Reloadhttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
Reloadhttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
pythonnet https://patch-diff.githubusercontent.com/pythonnet
pythonnethttps://patch-diff.githubusercontent.com/pythonnet/pythonnet
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 770 https://patch-diff.githubusercontent.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://patch-diff.githubusercontent.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://patch-diff.githubusercontent.com/pythonnet/pythonnet
Issues 155 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/issues
Pull requests 18 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/pulls
Discussions https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions
Actions https://patch-diff.githubusercontent.com/pythonnet/pythonnet/actions
Projects 0 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/projects
Wiki https://patch-diff.githubusercontent.com/pythonnet/pythonnet/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/pythonnet/pythonnet/security
Please reload this pagehttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
Insights https://patch-diff.githubusercontent.com/pythonnet/pythonnet/pulse
Code https://patch-diff.githubusercontent.com/pythonnet/pythonnet
Issues https://patch-diff.githubusercontent.com/pythonnet/pythonnet/issues
Pull requests https://patch-diff.githubusercontent.com/pythonnet/pythonnet/pulls
Discussions https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions
Actions https://patch-diff.githubusercontent.com/pythonnet/pythonnet/actions
Projects https://patch-diff.githubusercontent.com/pythonnet/pythonnet/projects
Wiki https://patch-diff.githubusercontent.com/pythonnet/pythonnet/wiki
Security https://patch-diff.githubusercontent.com/pythonnet/pythonnet/security
Insights https://patch-diff.githubusercontent.com/pythonnet/pythonnet/pulse
Answered https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002
filmorhttps://patch-diff.githubusercontent.com/filmor
nickna https://patch-diff.githubusercontent.com/nickna
Q&Ahttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/categories/q-a
Unable to from/import a .NET 8 library https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#top
nickna https://patch-diff.githubusercontent.com/nickna
Answered https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002
filmorhttps://patch-diff.githubusercontent.com/filmor
Return to tophttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#top
Please reload this pagehttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
nickna https://patch-diff.githubusercontent.com/nickna
Jul 23, 2024 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussion-6969977
this repohttps://github.com/nickna/Neighborly
https://private-user-images.githubusercontent.com/4017153/351496432-0b5b6469-fb69-490c-ab5c-865746c7d841.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg5NjA3NzQsIm5iZiI6MTc2ODk2MDQ3NCwicGF0aCI6Ii80MDE3MTUzLzM1MTQ5NjQzMi0wYjViNjQ2OS1mYjY5LTQ5MGMtYWI1Yy04NjU3NDZjN2Q4NDEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDEyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAxMjFUMDE1NDM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTI3OTQ0MzNiZjIyMGZhY2MwOGE0MmVjZDA4YmQwMWExZmIyNmJjZWEwYTgzYzU1MGYzYTg4ZDQ5YmI0NGI2YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tNap5CNYeo19BnY401ho9z1j3nuci9FtEnR88LXfvYk
Give feedback.https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
filmor https://patch-diff.githubusercontent.com/filmor
Jul 24, 2024 https://github.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002
View full answer https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002
Oldest https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421?sort=old
Newest https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421?sort=new
Top https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
filmor https://patch-diff.githubusercontent.com/filmor
Jul 24, 2024 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussioncomment-10132002
Give feedback.https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
nicknahttps://patch-diff.githubusercontent.com/nickna
Please reload this pagehttps://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
swatikd06 https://patch-diff.githubusercontent.com/swatikd06
Jul 18, 2025 https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421#discussioncomment-13810813
Give feedback.https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2421
🙏 Q&A https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/categories/q-a
https://patch-diff.githubusercontent.com/nickna
https://patch-diff.githubusercontent.com/filmor
https://patch-diff.githubusercontent.com/swatikd06
https://patch-diff.githubusercontent.com/pythonnet/pythonnet/discussions/2421
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.