Repository: conan-io/conan

Issue:
[bug] Inspect shows version as None when using `set_version()`
When using `set_version()` to version the package, `conan inspect` doesn't run the function, and as a result, prints "None". I would expect it to execute the function and include the version in the result out.

### Environment Details (include every applicable attribute)
  * Operating System+version: Windows 7
  * Compiler+version:
  * Conan version: 1.21.0
  * Python version: (via Conan Windows installer)

### Steps to reproduce (Include if Applicable)
Create a new conanfile.py, replacing the version with:

```py
 def set_version(self)
    self.version = "1.0"
```
Then run `conan inspect . --attribute version`.

### Logs (Executed commands with output) (Include/Attach if Applicable)

```
$ conan inspect . --attribute version
version: None
```


Discussion:

Resolving patch:
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -263,7 +263,7 @@ def inspect(self, path, attributes, remote_name=None):
             ref = ConanFileReference.loads(path)
         except ConanException:
             conanfile_path = _get_conanfile_path(path, get_cwd(), py=True)
-            conanfile = self.app.loader.load_basic(conanfile_path)
+            conanfile = self.app.loader.load_named(conanfile_path, None, None, None, None)
         else:
             update = True if remote_name else False
             result = self.app.proxy.get_recipe(ref, update, update, remotes, ActionRecorder())


Test patch:
diff --git a/conans/test/functional/command/inspect_test.py b/conans/test/functional/command/inspect_test.py
--- a/conans/test/functional/command/inspect_test.py
+++ b/conans/test/functional/command/inspect_test.py
@@ -3,7 +3,7 @@
 import textwrap
 import unittest
 
-from conans.test.utils.tools import TestClient, TestServer
+from conans.test.utils.tools import TestClient, TestServer, GenConanfile
 
 
 class ConanInspectTest(unittest.TestCase):
@@ -55,12 +55,7 @@ class MyLib(ConanFile):
     def name_version_test(self):
         server = TestServer()
         client = TestClient(servers={"default": server}, users={"default": [("lasote", "mypass")]})
-        conanfile = """from conans import ConanFile
-class Pkg(ConanFile):
-    name = "MyPkg"
-    version = "1.2.3"
-"""
-        client.save({"conanfile.py": conanfile})
+        client.save({"conanfile.py": GenConanfile().with_name("MyPkg").with_version("1.2.3")})
         client.run("inspect . -a=name")
         self.assertIn("name: MyPkg", client.out)
         client.run("inspect . -a=version")
@@ -86,6 +81,31 @@ class Pkg(ConanFile):
         client.run("inspect MyPkg/1.2.3@lasote/testing -a=version -r=default")
         self.assertIn("version: 1.2.3", client.out)
 
+    def set_name_version_test(self):
+        client = TestClient()
+        conanfile = textwrap.dedent("""
+            from conans import ConanFile, load
+            import os
+            class Pkg(ConanFile):
+                def set_name(self):
+                    self.name = "MyPkg"
+                def set_version(self):
+                    self.version = load(os.path.join(self.recipe_folder, "version.txt"))
+            """)
+        client.save({"conanfile.py": conanfile,
+                     "version.txt": "1.2.3"})
+        client.run("inspect . -a=name")
+        self.assertIn("name: MyPkg", client.out)
+        client.run("inspect . -a=version")
+        self.assertIn("version: 1.2.3", client.out)
+
+        client.run("export .")
+        client.save({}, clean_first=True)
+        client.run("inspect MyPkg/1.2.3@ -a=name")
+        self.assertIn("name: MyPkg", client.out)
+        client.run("inspect MyPkg/1.2.3@ -a=version")
+        self.assertIn("version: 1.2.3", client.out)
+
     def attributes_display_test(self):
         client = TestClient()
         conanfile = """from conans import ConanFile