René's URL Explorer Experiment


Title: "Using module" statement does not reload module after changes are made · Issue #7654 · PowerShell/PowerShell · GitHub

Open Graph Title: "Using module" statement does not reload module after changes are made · Issue #7654 · PowerShell/PowerShell

X Title: "Using module" statement does not reload module after changes are made · Issue #7654 · PowerShell/PowerShell

Description: Problem Description If you are using the using module statement, it will load the module without any issues. However, if you make a change to the module and run the using module statement again without restarting your PowerShell session,...

Open Graph Description: Problem Description If you are using the using module statement, it will load the module without any issues. However, if you make a change to the module and run the using module statement again wit...

X Description: Problem Description If you are using the using module statement, it will load the module without any issues. However, if you make a change to the module and run the using module statement again wit...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/7654

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Using module\" statement does not reload module after changes are made","articleBody":"Problem Description\r\n------------------\r\nIf you are using the `using module` statement, it will load the module without any issues. However, if you make a change to the module and run the `using module` statement again without restarting your PowerShell session, it will not load the new modified module into memory, and instead will continue to use the old existing module that was loaded. This makes doing development with `using module` statements very tedious as you must continually reload your PowerShell session whenever you make changes to the module.\r\n\r\nIdeally we would just use `Import-Module -Name [module name] -Force` to avoid this issue, but that does not work for importing `class`es, so the `using module` statement **must** be used.\r\n\r\n**Update:** This problem also exists in Windows PowerShell (not Core). Go [here to upvote](https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/35237182--using-module-statement-does-not-reload-module-af) that it gets fixed there too.\r\n\r\nSteps to reproduce\r\n------------------\r\nCreate the following module and script files:\r\n\r\nIn `TestModule.psm1`:\r\n```powershell\r\nclass TestClass \r\n{\r\n\t[string] $ClassPropertyText = \"Initial text\"\r\n}\r\n\r\nfunction Get-ModuleFunctionText()\r\n{\r\n\treturn \"Initial text\"\r\n}\r\n\r\nExport-ModuleMember -Function Get-ModuleFunctionText\r\n```\r\n\r\nIn `Test.ps1`:\r\n```powershell\r\nusing module '.\\TestModule.psm1'\r\n\r\n$instance = [TestClass]::new()\r\n$instance.ClassPropertyText\r\n\r\nGet-ModuleFunctionText\r\n```\r\n\r\nRun `Test.ps1` and it will output:\r\n```\r\nInitial text\r\nInitial text\r\n```\r\n\r\nThen modify `TestModule.psm1` to:\r\n```powershell\r\nclass TestClass \r\n{\r\n\t[string] $ClassPropertyText = \"Updated text\"\r\n}\r\n\r\nfunction Get-ModuleFunctionText()\r\n{\r\n\treturn \"Updated text\"\r\n}\r\n\r\nExport-ModuleMember -Function Get-ModuleFunctionText\r\n```\r\n\r\nRun `Test.ps1` again and it will still output:\r\n```\r\nInitial text\r\nInitial text\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\nWhen running `Test.ps1` the 2nd time, it should output:\r\n```none\r\nUpdated text\r\nUpdated text\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n```powershell\r\n> $PSVersionTable\r\nName                           Value\r\n----                           -----\r\nPSVersion                      5.1.17134.228\r\nPSEdition                      Desktop\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion                   10.0.17134.228\r\nCLRVersion                     4.0.30319.42000\r\nWSManStackVersion              3.0\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\n```\r\n\r\nAdditional Info\r\n----------------\r\nThe problem can be somewhat reduced by using _both_ the `using module` statement and `Import-Module -Force` statement, like this:\r\n```powershell\r\nusing module '.\\TestModule.psm1'\r\nImport-Module -Name '.\\TestModule.psm1' -Force\r\n\r\n$instance = [TestClass]::new()\r\n$instance.ClassPropertyText\r\n\r\nGet-ModuleFunctionText\r\n```\r\n\r\nThis code would result in the following output:\r\n```\r\nInitial text\r\nUpdated text\r\n```\r\n\r\nSo here the module code was updated, but the `class` code was not.\r\n\r\nProposed Solution\r\n----------------\r\nTo fix this issue I propose adding a `-Force` flag to the `using module` statement that forces the module to be reloaded into memory; the same way that the `-Force` flag works for the `Import-Module` cmdlet. This will allow developing code that uses the `class` construct to work much smoother.","author":{"url":"https://github.com/deadlydog","@type":"Person","name":"deadlydog"},"datePublished":"2018-08-28T23:54:19Z","url":"https://github.com/PowerShell/PowerShell/issues/7654"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:594f6aea-8eca-9812-5ee3-669ac7671cc0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD17A:1B7BAF:195553:247462:6AFDCFA2
html-safe-nonce475537376a835a563710bd1b0c5a99180fbc845823f50608defd30048a06eac4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTdBOjFCN0JBRjoxOTU1NTM6MjQ3NDYyOjZBRkRDRkEyIiwidmlzaXRvcl9pZCI6IjMxNTgzMzI3ODU5MTU5NzM1MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf12981c9ff9aef51d38ebefadc2b8463d3628a44c224bae3286a5b1e826983db
hovercard-subject-tagissue:354945356
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/7654/issue_layout
twitter:imagehttps://opengraph.githubassets.com/494146005f4a331d42d7d92a2f32f68b7191bdcf3c1853256f659efb18d1a60d/PowerShell/PowerShell/issues/7654
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/494146005f4a331d42d7d92a2f32f68b7191bdcf3c1853256f659efb18d1a60d/PowerShell/PowerShell/issues/7654
og:image:altProblem Description If you are using the using module statement, it will load the module without any issues. However, if you make a change to the module and run the using module statement again wit...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedeadlydog
hostnamegithub.com
expected-hostnamegithub.com
None26886a40b582b821a7a76351e0a2f42b6d6160854b6e2520db24f31fd7be5da7
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
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
release68ebaa631a1d248d69ebde4b9c5defd3a19aeb2f
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/7654#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F7654
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F7654
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/7654
Reloadhttps://github.com/PowerShell/PowerShell/issues/7654
Reloadhttps://github.com/PowerShell/PowerShell/issues/7654
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests366 (366)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/7654
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/7654
"Using module" statement does not reload module after changes are madehttps://github.com/PowerShell/PowerShell/issues/7654#top
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
KeepOpenThe bot will ignore these and not auto-closehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22KeepOpen%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
https://github.com/deadlydog
Daniel Schroeder (deadlydog)https://github.com/deadlydog
on Aug 28, 2018https://github.com/PowerShell/PowerShell/issues/7654#issue-354945356
here to upvotehttps://windowsserver.uservoice.com/forums/301869-powershell/suggestions/35237182--using-module-statement-does-not-reload-module-af
Nexthttps://github.com/PowerShell/PowerShell/issues/7654?timeline_page=1
https://github.com/MaximoTrinidad
Maximo Trinidad (MaximoTrinidad)https://github.com/MaximoTrinidad
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416784807
https://windowsserver.uservoice.com/forums/301869-powershellhttps://windowsserver.uservoice.com/forums/301869-powershell
https://github.com/PowerShell/PowerShell#windows-powershell-vs-powershell-corehttps://github.com/PowerShell/PowerShell#windows-powershell-vs-powershell-core
https://github.com/deadlydog
Daniel Schroeder (deadlydog)https://github.com/deadlydog
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416790938
Maximo Trinidad (@MaximoTrinidad)https://github.com/MaximoTrinidad
this issue in the Windows PowerShell UserVoice as well herehttps://windowsserver.uservoice.com/forums/301869-powershell/suggestions/35237182--using-module-statement-does-not-reload-module-af
https://github.com/MaximoTrinidad
Maximo Trinidad (MaximoTrinidad)https://github.com/MaximoTrinidad
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416791659
Daniel Schroeder (@deadlydog)https://github.com/deadlydog
https://github.com/MaximoTrinidad
Maximo Trinidad (MaximoTrinidad)https://github.com/MaximoTrinidad
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416795495
Daniel Schroeder (@deadlydog)https://github.com/deadlydog
https://github.com/BrucePay
Bruce Payette (BrucePay)https://github.com/BrucePay
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416818516
https://github.com/datenschieber
datenschieberhttps://github.com/datenschieber
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416851732
#2505https://github.com/PowerShell/PowerShell/issues/2505
https://github.com/deadlydog
Daniel Schroeder (deadlydog)https://github.com/deadlydog
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-416964296
datenschieberhttps://github.com/datenschieber
#2505https://github.com/PowerShell/PowerShell/issues/2505
#2505https://github.com/PowerShell/PowerShell/issues/2505
#2505https://github.com/PowerShell/PowerShell/issues/2505
Ilya (iSazonov)https://github.com/iSazonov
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
on Aug 29, 2018https://github.com/PowerShell/PowerShell/issues/7654#event-1816036826
https://github.com/BrucePay
Bruce Payette (BrucePay)https://github.com/BrucePay
on Aug 30, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-417411829
Daniel Schroeder (@deadlydog)https://github.com/deadlydog
https://github.com/deadlydog
Daniel Schroeder (deadlydog)https://github.com/deadlydog
on Aug 31, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-417536470
Bruce Payette (@BrucePay)https://github.com/BrucePay
https://github.com/BrucePay
Bruce Payette (BrucePay)https://github.com/BrucePay
on Aug 31, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-417565560
Daniel Schroeder (@deadlydog)https://github.com/deadlydog
https://github.com/deadlydog
Daniel Schroeder (deadlydog)https://github.com/deadlydog
on Sep 2, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-417902993
Bruce Payette (@BrucePay)https://github.com/BrucePay
https://github.com/LosManos
LosManos (LosManos)https://github.com/LosManos
on Sep 25, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-424225084
Stackoverflow questionhttps://stackoverflow.com/questions/52413490/powershell-forcing-reload-for-using-module
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Sep 25, 2018https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-424286838
https://github.com/AlfiCode
AlfiCodehttps://github.com/AlfiCode
on Apr 8, 2020https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-610879498
https://github.com/holylander
Alberto SC (holylander)https://github.com/holylander
on Jul 2, 2020https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-653072583
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
https://user-images.githubusercontent.com/1187140/48651892-85a65d80-e9c2-11e8-95bb-d5c0bb729eac.png
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jun 29, 2021https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-870796566
#2505 (comment)https://github.com/PowerShell/PowerShell/issues/2505#issuecomment-385066132
https://github.com/justintoo
Justin Too (justintoo)https://github.com/justintoo
on Aug 6, 2021https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-894564671
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-1813893464
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-1813893469
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/7654#event-10976558149
https://github.com/drdamour
drdamourhttps://github.com/drdamour
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-1814157989
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-1824384548
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/7654#event-11047374128
https://github.com/cschar
cschar (cschar)https://github.com/cschar
on Jun 20, 2025https://github.com/PowerShell/PowerShell/issues/7654#issuecomment-2992632609
Staffan Gustafsson (powercode)https://github.com/powercode
KeepOpenThe bot will ignore these and not auto-closehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22KeepOpen%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
on Jun 24, 2025https://github.com/PowerShell/PowerShell/issues/7654#event-18291263482
Staffan Gustafsson (powercode)https://github.com/powercode
on Jun 24, 2025https://github.com/PowerShell/PowerShell/issues/7654#event-18291276972
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/7654
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/7654
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
KeepOpenThe bot will ignore these and not auto-closehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22KeepOpen%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
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.